Show / Hide Table of Contents

Class InterfaceTypeDictionary<V>

An implementation of the ITypeDictionary<V> interface that allows retrieving information using interface types.

Inheritance
object
InterfaceTypeDictionary<V>
Implements
ITypeDictionary<V>
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 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 key is null.

AmbiguousTypeException

Thrown if key does not point to a single instance.

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 key is null.

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

true if the dictionary contains the value; otherwise, false.

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

true if the dictionary contains a value with the specified key; otherwise, false.

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 key is null.

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

true if the value was remove; otherwise, false.

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

true if the value was found; otherwise, false.

Implements

ITypeDictionary<V>

Extension Methods

Utility.ThrowIfNull<T>(T, string)

See Also

ITypeDictionary<V>
In this article
Back to top Generated by DocFX