Interface IDictionaryTypeShape<TDictionary, TKey, TValue>
- Namespace
- PolyType.Abstractions
- Assembly
- PolyType.dll
Provides a strongly typed shape model for a .NET type that is a dictionary.
public interface IDictionaryTypeShape<TDictionary, TKey, TValue> : ITypeShape<TDictionary>, IDictionaryTypeShape, ITypeShape where TKey : notnull
Type Parameters
TDictionary
The type of the underlying dictionary.
TKey
The type of the underlying key.
TValue
The type of the underlying value.
- Inherited Members
Remarks
Typically covers types implementing interfaces such as IDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue> or IDictionary.
Properties
KeyType
Gets the shape of the underlying key type.
ITypeShape<TKey> KeyType { get; }
Property Value
- ITypeShape<TKey>
Remarks
For non-generic dictionaries this returns the shape for object.
ValueType
Gets the shape of the underlying value type.
ITypeShape<TValue> ValueType { get; }
Property Value
- ITypeShape<TValue>
Remarks
For non-generic dictionaries this returns the shape for object.
Methods
GetAddKeyValuePair()
Creates a setter delegate used for appending a KeyValuePair<TKey, TValue> to a mutable dictionary.
Setter<TDictionary, KeyValuePair<TKey, TValue>> GetAddKeyValuePair()
Returns
- Setter<TDictionary, KeyValuePair<TKey, TValue>>
A setter delegate used for appending entries to a mutable dictionary.
Exceptions
- InvalidOperationException
The collection is not Mutable.
GetEnumerableCollectionConstructor()
Creates a delegate for creating a collection from an enumerable.
EnumerableCollectionConstructor<TKey, KeyValuePair<TKey, TValue>, TDictionary> GetEnumerableCollectionConstructor()
Returns
- EnumerableCollectionConstructor<TKey, KeyValuePair<TKey, TValue>, TDictionary>
A delegate constructing a collection from an enumerable of values.
Exceptions
- InvalidOperationException
The collection is not Enumerable.
GetGetDictionary()
Creates a delegate used for getting a IReadOnlyDictionary<TKey, TValue> view of the dictionary.
Func<TDictionary, IReadOnlyDictionary<TKey, TValue>> GetGetDictionary()
Returns
- Func<TDictionary, IReadOnlyDictionary<TKey, TValue>>
A delegate accepting a
TDictionary
and returning an IReadOnlyDictionary<TKey, TValue> view of the instance.
GetMutableCollectionConstructor()
Creates a delegate for creating an empty, mutable collection.
MutableCollectionConstructor<TKey, TDictionary> GetMutableCollectionConstructor()
Returns
- MutableCollectionConstructor<TKey, TDictionary>
A delegate for creating an empty mutable collection.
Exceptions
- InvalidOperationException
The collection is not Mutable.
GetSpanCollectionConstructor()
Creates a delegate for creating a collection from a span.
SpanCollectionConstructor<TKey, KeyValuePair<TKey, TValue>, TDictionary> GetSpanCollectionConstructor()
Returns
- SpanCollectionConstructor<TKey, KeyValuePair<TKey, TValue>, TDictionary>
A delegate constructing a collection from a span of values.
Exceptions
- InvalidOperationException
The collection is not Span.