Class InterfaceTypeDictionary<V>
An implementation of the ITypeDictionary<V> interface that allows retrieving information using interface types.
Implements
Inherited Members
Namespace: SpiceSharp.General
Assembly: SpiceSharp.dll
Syntax
public class InterfaceTypeDictionary<V> : ITypeDictionary<V>
Type Parameters
Name | Description |
---|---|
V | The value type. |
Constructors
InterfaceTypeDictionary()
Initializes a new instance of the InterfaceTypeDictionary<V> class.
Declaration
public InterfaceTypeDictionary()
Properties
Count
Gets the number of items in the dictionary.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int | The number of items in the dictionary. |
this[Type]
Gets a value from the dictionary by its type.
Declaration
public V this[Type key] { get; }
Parameters
Type | Name | Description |
---|---|---|
Type | key | The type. |
Property Value
Type | Description |
---|---|
V | The value. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
AmbiguousTypeException | Thrown if |
Keys
Gets all the keys in the dictionary.
Declaration
public IEnumerable<Type> Keys { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Type> | The keys in the dictionary. |
Values
Gets all the values in the dictionary.
Declaration
public IEnumerable<V> Values { get; }
Property Value
Type | Description |
---|---|
IEnumerable<V> | The values in the dictionary. |
Methods
Add(Type, V)
Adds a value to the dictionary.
Declaration
public void Add(Type key, V value)
Parameters
Type | Name | Description |
---|---|---|
Type | key | The key type. |
V | value | The value. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Clear()
Clears all values from the dictionary.
Declaration
public void Clear()
Contains(V)
Determines whether the dictionary contains the value.
Declaration
public bool Contains(V value)
Parameters
Type | Name | Description |
---|---|---|
V | value | The value. |
Returns
Type | Description |
---|---|
bool |
|
ContainsKey(Type)
Determines whether the dictionary contains a value with the specified key.
Declaration
public bool ContainsKey(Type key)
Parameters
Type | Name | Description |
---|---|---|
Type | key | The key. |
Returns
Type | Description |
---|---|
bool |
|
GetAllValues(Type)
Gets all values from the dictionary that the specified key can point to.
Declaration
public IEnumerable<V> GetAllValues(Type key)
Parameters
Type | Name | Description |
---|---|---|
Type | key |
Returns
Type | Description |
---|---|
IEnumerable<V> | The values. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
GetValueCount(Type)
Gets the the number of values that this type points to (direct or indirect).
Declaration
public int GetValueCount(Type key)
Parameters
Type | Name | Description |
---|---|---|
Type | key | The key. |
Returns
Type | Description |
---|---|
int | The number of values. |
Remove(Type, V)
Removes a value from the dictionary, but only if the value was added through the same key originally to avoid inconsistencies.
Declaration
public bool Remove(Type key, V value)
Parameters
Type | Name | Description |
---|---|---|
Type | key | The key. |
V | value | The value. |
Returns
Type | Description |
---|---|
bool |
|
TryGetValue(Type, out V)
Tries to get a value from the dictionary indexed by the specified type.
Declaration
public bool TryGetValue(Type key, out V value)
Parameters
Type | Name | Description |
---|---|---|
Type | key | The key. |
V | value | The value. |
Returns
Type | Description |
---|---|
bool |
|