Provides extensions to convert from non-generic IDictionary to a generic one.
More...
|
static IDictionary< TKey, TValue > | ToDictionary< TKey, TValue > (this IDictionary dict, Func< DictionaryEntry, TKey > keyGenerator, Func< DictionaryEntry, TValue > valueGenerator) |
| Convert the given IDictionary to IDictionary<TKey, TValue> with the provided key and value generator functions.
|
static IDictionary< TKey, TValue > | ToDictionary< TKey, TValue > (this IDictionary dict) |
| Converts the given non-generic IDictionary to IDictionary<TKey, TValue> with hard casting of keys and values in the source to the provided types.
|
static IDictionary< TKey, TValue > | Inverted< TKey, TValue > (this IDictionary< TValue, TKey > src) |
| Produces a new dictionary where the key and value have been inverted, ie the values become keys. This will only work if the values are distinct.
|
static IDictionary< TKey, TValue > | Inverted< TKey, TValue > (this IDictionary< TValue, TKey > src, IEqualityComparer< TKey > keyComparer) |
| Produces a new dictionary where the key and value have been inverted, ie the values become keys. This will only work if the values are distinct.
|
static IDictionary< string, string > | ToDictionary (this NameValueCollection nameValueCollection) |
| Converts a NameValueCollection.
|
static IDictionary< string, string > | ToDictionary< T1, T2 > (this IEnumerable< KeyValuePair< T1, T2 > > src) |
| Provides a string/string dictionary for anything providing the IEnumerable<KeyValuePair<T1, T2>> interface, eg query / form collections.
|
static IDictionary< string, string > | ToDictionary< T1, T2 > (this IEnumerable< KeyValuePair< T1, T2 > > src, Func< T1, string > keyConverter, Func< T2, string > valueConverter) |
| Provides a string/string dictionary for anything providing the IEnumerable<KeyValuePair<T1, T2>> interface, providing the mechanism for the caller to convert to strings.
|
static IDictionary< string, string > | ToDictionary (this IDictionary dict) |
| Shorthand for .ToDictionary<string, string>()
|
static TValue | FindOrAdd< TKey, TValue > (this IDictionary< TKey, TValue > dict, TKey key, TValue value) |
| Find an item in or add an item to a dictionary.
|
static TValue | FindOrAdd< TKey, TValue > (this IDictionary< TKey, TValue > dict, TKey key, Func< TValue > generator) |
| Find an item in or add an item to a dictionary.
|
static TValue | FindOrAdd< TKey, TValue > (this IDictionary< TKey, TValue > dict, TKey key, Func< TValue > generator, Func< TValue, bool > skipCaching) |
| Find an item in or add an item to a dictionary.
|
static TValue | FindOrAdd< TKey, TValue > (this IDictionary< TKey, TValue > dict, TKey key, Func< TValue > generator, bool alwaysLock) |
| Find an item in or add an item to a dictionary.
|
static TValue | FindOrAdd< TKey, TValue > (this IDictionary< TKey, TValue > dict, TKey key, Func< TValue > generator, Func< TValue, bool > skipCaching, bool alwaysLock) |
| Find an item in or add an item to a dictionary.
|
static IDictionary< TKey, TValue > | Clone< TKey, TValue > (this IDictionary< TKey, TValue > dict) |
| Clones a given dictionary - new collection, same items.
|
static IDictionary< TKey, TValue > | MergedWith< TKey, TValue > (this IDictionary< TKey, TValue > first, IDictionary< TKey, TValue > second) |
| Merge second dictionary into the first, producing a new dictionary output, with the second's values taking precedence over the first's.
|
static IDictionary< TKey, TValue > | MergedWith< TKey, TValue > (this IDictionary< TKey, TValue > first, IDictionary< TKey, TValue > second, MergeWithPrecedence withPrecedence) |
| Merge second dictionary into the first, producing a new dictionary output, with the provided merge-precedence.
|
static IDictionary< TKey, TValue > | MergeInto< TKey, TValue > (this IDictionary< TKey, TValue > newData, IDictionary< TKey, TValue > target) |
| Merges the new data into the target, preferring to keep the original values in the target when also specified in the new data.
|
static IDictionary< TKey, TValue > | MergeInto< TKey, TValue > (this IDictionary< TKey, TValue > newData, IDictionary< TKey, TValue > target, MergeIntoPrecedence mergePrecedence) |
| Merges the new data into the target, with the specified merge preference.
|
static IDictionary< string, string > | ToDictionary (this NameValueCollection collection, IEqualityComparer< string > keyComparer) |
| Converts a NameValueCollection to a dictionary with the provided key comparer.
|
static NameValueCollection | ToNameValueCollection (this IDictionary< string, string > dict) |
| Converts a NameValueCollection to a dictionary.
|
static bool | TryAdd< TKey, TValue > (this IDictionary< TKey, TValue > subject, TKey key, TValue value) |
| Attempts to add an item to the dictionary. Returns true if the item was added. Will lock the dictionary, so is thread-safe against itself or anything else calling lock() on the subject.
|
static IDictionary< TKey, TValue > | AddOrUpdate< TKey, TValue > (this IDictionary< TKey, TValue > dictionary, TKey key, Func< TValue > generator, Func< TValue, TValue > mutator) |
| Either add a new value to a dictionary or update the existing one.
|
Provides extensions to convert from non-generic IDictionary to a generic one.