Show / Hide Table of Contents

Class InheritedTypeSet<V>

An InheritedTypeDictionary<V> that can add values by their own types.

Inheritance
object
InheritedTypeSet<V>
Implements
ITypeSet<V>
ICollection<V>
IEnumerable<V>
IEnumerable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SpiceSharp.General
Assembly: SpiceSharp.dll
Syntax
public class InheritedTypeSet<V> : ITypeSet<V>, ICollection<V>, IEnumerable<V>, IEnumerable
Type Parameters
Name Description
V

The base value type.

Constructors

InheritedTypeSet()

Initializes a new instance of the InheritedTypeSet<V> class.

Declaration
public InheritedTypeSet()

Properties

Count

Gets the number of elements contained in the set.

Declaration
public int Count { get; }
Property Value
Type Description
int

IsReadOnly

Gets a value indicating whether the set is read-only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
bool

Methods

Add(V)

Adds the specified value.

Declaration
public void Add(V value)
Parameters
Type Name Description
V value

The value.

Clear()

Removes all items from the set.

Declaration
public void Clear()

Contains(V)

Determines whether this instance contains the object.

Declaration
public bool Contains(V item)
Parameters
Type Name Description
V item

The object to locate in the set.

Returns
Type Description
bool

true if item is found in the set; otherwise, false.

ContainsType(Type)

Determines whether this instance contains a value of the specified type.

Declaration
public bool ContainsType(Type key)
Parameters
Type Name Description
Type key

The key.

Returns
Type Description
bool

true if the specified key contains type; otherwise, false.

Exceptions
Type Condition
ArgumentNullException

Thrown if key is null.

ContainsType<TResult>()

Determines whether this instance contains a value of the specified type.

Declaration
public bool ContainsType<TResult>() where TResult : V
Returns
Type Description
bool

true if this instance contains type; otherwise, false.

Type Parameters
Name Description
TResult

The type of the result.

CopyTo(V[], int)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

Declaration
public void CopyTo(V[] array, int arrayIndex)
Parameters
Type Name Description
V[] array

The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.

int arrayIndex

The zero-based index in array at which copying begins.

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration
public IEnumerator<V> GetEnumerator()
Returns
Type Description
IEnumerator<V>

An enumerator that can be used to iterate through the collection.

GetValue<TResult>()

Gets a value from the set with the specified type.

Declaration
public TResult GetValue<TResult>() where TResult : V
Returns
Type Description
TResult

The value.

Type Parameters
Name Description
TResult

The result type.

Exceptions
Type Condition
AmbiguousTypeException

Thrown if the type could not be resolved to a single instance.

Remove(V)

Removes the first occurrence of a specific object from the set.

Declaration
public bool Remove(V item)
Parameters
Type Name Description
V item

The object to remove from the set.

Returns
Type Description
bool

true if item was successfully removed from the set; otherwise, false. This method also returns false if item is not found in the original set.

TryGetValue<TResult>(out TResult)

Tries getting a value from the set with the specified type.

Declaration
public bool TryGetValue<TResult>(out TResult value) where TResult : V
Parameters
Type Name Description
TResult value

The value.

Returns
Type Description
bool

true if the value was found; otherwise, false.

Type Parameters
Name Description
TResult

The result type.

Exceptions
Type Condition
AmbiguousTypeException

Thrown if the type could not be resolved to a single instance.

Events

TypeNotFound

Occurs if a type could not be found.

Declaration
public event EventHandler<TypeNotFoundEventArgs<V>> TypeNotFound
Event Type
Type Description
EventHandler<TypeNotFoundEventArgs<V>>

Implements

ITypeSet<V>
ICollection<T>
IEnumerable<T>
IEnumerable

Extension Methods

Utility.ThrowIfNull<T>(T, string)
Utility.ThrowIfEmpty<T>(IEnumerable<T>, string)
In this article
Back to top Generated by DocFX