Class InheritedTypeSet<V>
An InheritedTypeDictionary<V> that can add values by their own types.
Inherited Members
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 |
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 |
|
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
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 |
|
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 |
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 |
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 |
|
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>> |