Class DictionaryExtensions
- Namespace
- Cratis.Reflection
- Assembly
- Cratis.Fundamentals.dll
Provides extension methods for Type.
public static class DictionaryExtensions
- Inheritance
-
DictionaryExtensions
- Inherited Members
Methods
GetKeyType(Type)
Get the key type of a dictionary.
[UnconditionalSuppressMessage("Trimming", "IL2070", Justification = "Dictionary interfaces are BCL types that are always preserved by the runtime.")]
public static Type GetKeyType(this Type type)
Parameters
typeTypeDictionary type to get from.
Returns
- Type
Type of key.
GetKeyValuePairs(IEnumerable)
Get the key value pairs from a dictionary.
[RequiresDynamicCode("Uses MakeGenericType to construct KeyValuePair<,> at runtime.")]
[UnconditionalSuppressMessage("Trimming", "IL2072", Justification = "Dictionary interfaces are BCL types that are always preserved by the runtime.")]
public static IEnumerable<KeyValuePair<string, object>> GetKeyValuePairs(this IEnumerable enumerable)
Parameters
enumerableIEnumerableIEnumerable which is a dictionary to get from.
Returns
- IEnumerable<KeyValuePair<string, object>>
A collection of key value pairs of string type.
GetValueType(Type)
Get the key type of a dictionary.
[UnconditionalSuppressMessage("Trimming", "IL2070", Justification = "Dictionary interfaces are BCL types that are always preserved by the runtime.")]
public static Type GetValueType(this Type type)
Parameters
typeTypeDictionary type to get from.
Returns
- Type
Type of key.
IsDictionary(Type)
Check if a type is a dictionary.
[UnconditionalSuppressMessage("Trimming", "IL2070", Justification = "Dictionary interfaces are BCL types that are always preserved by the runtime.")]
public static bool IsDictionary(this Type type)
Parameters
typeTypeType to check.
Returns
- bool
True if it is, false if not.