Class DictionaryExtensions
Inheritance
DictionaryExtensions
Assembly: Estrelica.Utility.dll
Syntax
[DoNotObfuscateType]
public static class DictionaryExtensions
Methods
Declaration
public static IDictionary<K, V> AddAll<K, V>(this IDictionary<K, V> dict, IEnumerable<KeyValuePair<K, V>> values, Func<K, V, V, bool> duplicateKeyHandler = null)
Parameters
Returns
Type Parameters
Declaration
public static IDictionary<K, V> AddAll<K, V>(this IDictionary<K, V> dict, IEnumerable<V> values, Func<V, K> getKeyForItem)
Parameters
Returns
Type Parameters
Declaration
public static IEnumerable<V> AsArray<V>(this IEnumerable<V> value, bool emptyArrayIfNull = true)
Parameters
Returns
Type Parameters
Declaration
public static IDictionary<string, dynamic> AsArrays(this IDictionary<string, dynamic> dict)
Parameters
Returns
Declaration
public static IEnumerable<IDictionary<string, dynamic>> AsArrays(this IEnumerable<IDictionary<string, dynamic>> dictionaries)
Parameters
Returns
Declaration
public static IDictionary<K, IEnumerable<V>> AsArrays<K, V>(this IDictionary<K, IEnumerable<V>> dict, bool emptyArraysIfNull = true)
Parameters
Returns
Type Parameters
Declaration
public static bool ContainsAll<T>(this IEnumerable<T> iterator, IEnumerable<T> compareTarget, IEqualityComparer<T> comparer = null)
Parameters
Returns
Type Parameters
Declaration
public static bool ContainsAny<T>(this IEnumerable<T> iterator, IEnumerable<T> compareTarget, IEqualityComparer<T> comparer = null)
Parameters
Returns
Type Parameters
Declaration
public static bool ContainsKeyOfType<V>(this IDictionary<int, dynamic> dict, int key)
Parameters
Returns
Type Parameters
Declaration
public static bool ContainsKeyOfType<V>(this IDictionary<string, dynamic> dict, string key)
Parameters
Returns
Type Parameters
Declaration
public static void ConvertEnum<T>(this IDictionary<string, dynamic> dict, string key, T defaultIfUndefined) where T : Enum
Parameters
Type Parameters
Declaration
public static void Deconstruct<T1, T2>(this KeyValuePair<T1, T2> tuple, out T1 key, out T2 value)
Parameters
Type Parameters
Declaration
public static V EnumValueOrDefault<V>(this IDictionary<int, dynamic> dict, int key) where V : struct
Parameters
Returns
Type Parameters
Declaration
public static V EnumValueOrDefault<V>(this IDictionary<int, dynamic> dict, int key, V defaultIfUndefined, bool throwExceptionIfInvalid = true) where V : struct
Parameters
Returns
Type Parameters
Declaration
public static V EnumValueOrDefault<V>(this IDictionary<string, dynamic> dict, string key) where V : struct
Parameters
Returns
Type Parameters
Declaration
public static V EnumValueOrDefault<V>(this IDictionary<string, dynamic> dict, string key, V defaultIfUndefined, bool throwExceptionIfInvalid = true) where V : struct
Parameters
Returns
Type Parameters
Declaration
public static V EnumValueOrDefault<K, V>(this IDictionary<K, dynamic> dict, K key) where V : struct
Parameters
Returns
Type Parameters
Declaration
public static V EnumValueOrDefault<K, V>(this IDictionary<K, dynamic> dict, K key, V defaultIfUndefined, bool throwExceptionIfInvalid) where V : struct
Parameters
IDictionary<K, dynamic>
dict
|
K
key
|
V
defaultIfUndefined
|
bool
throwExceptionIfInvalid
|
Returns
Type Parameters
Declaration
public static IDictionary<string, dynamic> FixEmptyArrayType<V>(this IDictionary<string, dynamic> dict, string key)
Parameters
Returns
Type Parameters
Declaration
public static void FixEnum<T>(this IDictionary<string, dynamic> dict, string key) where T : Enum
Parameters
Type Parameters
Declaration
public static IEnumerable<T> ForEach<T>(this IEnumerable<T> iterator, Action<T> operation)
Parameters
Returns
Type Parameters
Declaration
public static bool GetDeepValue(this IDictionary<string, dynamic> dict, string key, ref dynamic value, char keySeparator = '.')
Parameters
Returns
Declaration
public static bool GetDeepValue(this IDictionary dict, string key, ref dynamic value, char keySeparator = '.')
Parameters
Returns
Declaration
public static bool GetDeepValues(this IEnumerable<IDictionary<string, dynamic>> dictionaries, string key, ref IEnumerable<dynamic> values, char keySeparator = '.')
Parameters
Returns
Declaration
public static IEnumerable<int> GetIds(this IEnumerable<IDictionary<string, dynamic>> items)
Parameters
Returns
Declaration
public static IEnumerable<T> GetValueFromEach<T>(this IEnumerable<IDictionary<string, dynamic>> items, string keyName)
Parameters
Returns
Type Parameters
Declaration
public static string GetValuesAsString(this IDictionary<string, dynamic> dict, IEnumerable<string> keys = null, bool useWindowsNewline = true)
Parameters
Returns
Declaration
public static IDictionary<K, IEnumerable<K>> InvertDictionary<K>(this IDictionary<K, IEnumerable<K>> dict)
Parameters
Returns
Type Parameters
Declaration
public static bool IsNullOrEmpty<K, V>(this IDictionary<K, V> dict)
Parameters
Returns
Type Parameters
Declaration
public static IDictionary<K, V> LoadFromQuery<K, V>(this IDictionary<K, V> dict, string connectionString, string query, Action<SqlCommand> cmdSetup = null)
Parameters
Returns
Type Parameters
Declaration
public static IDictionary<K, V> LoadFromQuery<K, V>(this IDictionary<K, V> dict, string connectionString, string query, K defaultKeyIfDBNull, V defaultValueIfDBNull, Action<SqlCommand> cmdSetup = null)
Parameters
Returns
Type Parameters
Declaration
public static IDictionary<K, V> MergeFrom<K, V>(this IDictionary<K, V> dict, IDictionary<K, V> source, bool overwriteExistingKeys = false)
Parameters
Returns
Type Parameters
Declaration
public static IDictionary<string, dynamic> RenameKey(this IDictionary<string, dynamic> dict, string oldKey, string newKey, bool ignoreDuplicates = false)
Parameters
Returns
Declaration
public static IDictionary<string, dynamic> RenameKeyOfType<V>(this IDictionary<string, dynamic> dict, string oldKey, string newKey, bool ignoreDuplicates = false)
Parameters
Returns
Type Parameters
Declaration
public static IDictionary<K, V> SetAll<K, V>(this IDictionary<K, V> dict, IEnumerable<KeyValuePair<K, V>> values)
Parameters
Returns
Type Parameters
Declaration
public static IDictionary<K, V> Set<K, V>(this IDictionary<K, V> dict, K key, V value, bool ignoreIfNull = false)
Parameters
Returns
Type Parameters
Declaration
public static IDictionary<string, object> ToDictionary(this JObject @object)
Parameters
Returns
Declaration
public static IDictionary<K, V> ToDictionary<K, V>(this IEnumerable<KeyValuePair<K, V>> values)
Parameters
Returns
Type Parameters
Declaration
public static Task<V> ValueOrCreateAsync<K, V>(this IDictionary<K, V> dict, K key, Func<Task<V>> instantiator)
Parameters
Returns
Type Parameters
Declaration
public static Task<V> ValueOrCreateAsync<K, V>(this IDictionary<K, V> dict, K key, Func<V> instantiator = null)
Parameters
Returns
Type Parameters
Declaration
public static Task<V> ValueOrCreateAsync<K, V>(this IDictionary<K, V> dict, K key, Task<V> instantiator)
Parameters
Returns
Type Parameters
Declaration
public static V ValueOrCreateNonNull<K, V>(this IDictionary<K, V> dict, K key, Func<V> instantiator = null) where V : class
Parameters
Returns
Type Parameters
Declaration
public static V2 ValueOrCreateType<V2>(this IDictionary<string, dynamic> dict, string key, Func<V2> instantiator = null) where V2 : class
Parameters
Returns
Type Parameters
Declaration
public static V2 ValueOrCreateType<V2, K, V>(this IDictionary<K, V> dict, K key, Func<V2> instantiator = null) where V2 : class where V : class
Parameters
Returns
Type Parameters
Declaration
public static V ValueOrCreate<K, V>(this IDictionary<K, V> dict, K key, Func<V> instantiator = null)
Parameters
Returns
Type Parameters
Declaration
public static V ValueOrDefault<V>(this IDictionary<int, dynamic> dict, int key)
Parameters
Returns
Type Parameters
Declaration
public static V ValueOrDefault<V>(this IDictionary<int, dynamic> dict, int key, V defaultIfUndefined)
Parameters
Returns
Type Parameters
Declaration
public static V ValueOrDefault<V>(this IDictionary<string, dynamic> dict, string key)
Parameters
Returns
Type Parameters
Declaration
public static V ValueOrDefault<V>(this IDictionary<string, dynamic> dict, string key, V defaultIfUndefined)
Parameters
Returns
Type Parameters
Declaration
public static V ValueOrDefault<K, V>(this IDictionary<K, dynamic> dict, K key)
Parameters
Returns
Type Parameters
Declaration
public static V ValueOrDefault<K, V>(this IDictionary<K, dynamic> dict, K key, V defaultIfUndefined)
Parameters
IDictionary<K, dynamic>
dict
|
K
key
|
V
defaultIfUndefined
|
Returns
Type Parameters
Declaration
public static V ValueOrDefault<K, V>(this IDictionary<K, V> dict, K key)
Parameters
Returns
Type Parameters
Declaration
public static V ValueOrDefault<K, V>(this IDictionary<K, V> dict, K key, V defaultIfUndefined)
Parameters
Returns
Type Parameters