Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Static Public Member Functions | List of all members
Loyc.Collections.DictionaryExt Class Reference

Extension methods for Dictionary{K,V} and IDictionary{K,V}. More...


Source file:

Remarks

Extension methods for Dictionary{K,V} and IDictionary{K,V}.

Static Public Member Functions

static V TryGetValue< K, V > (this Dictionary< K, V > dict, K key, V defaultValue)
 An alternate version TryGetValue that returns a default value if the key was not found in the dictionary, and that does not throw if the key is null. More...
 
static V TryGetValue< K, V > (this IDictionary< K, V > dict, K key, V defaultValue)
 
static V TryGetValue< K, V > (this IReadOnlyDictionary< K, V > dict, K key, V defaultValue)
 
static Maybe< V > TryGetValue< K, V > (this IDictionary< K, V > dict, K key)
 Same as IDictionary.TryGetValue() except that this method does not throw an exception when key==null (it simply returns NoValue), and it returns the result as Maybe{V} instead of storing the result in an "out" parameter. More...
 
static Maybe< V > TryGetValue< K, V > (this IReadOnlyDictionary< K, V > dict, K key)
 
static bool TryGetValueSafe< K, V > (this IDictionary< K, V > dict, K key, out V value)
 Same as IDictionary.TryGetValue() except that this method does not throw an exception when key==null (it simply returns false). More...
 

Member Function Documentation

static V Loyc.Collections.DictionaryExt.TryGetValue< K, V > ( this Dictionary< K, V >  dict,
key,
defaultValue 
)
inlinestatic

An alternate version TryGetValue that returns a default value if the key was not found in the dictionary, and that does not throw if the key is null.

Returns
The value associated with the specified key, or defaultValue if no value is associated with the key.
static Maybe<V> Loyc.Collections.DictionaryExt.TryGetValue< K, V > ( this IDictionary< K, V >  dict,
key 
)
inlinestatic

Same as IDictionary.TryGetValue() except that this method does not throw an exception when key==null (it simply returns NoValue), and it returns the result as Maybe{V} instead of storing the result in an "out" parameter.

static bool Loyc.Collections.DictionaryExt.TryGetValueSafe< K, V > ( this IDictionary< K, V >  dict,
key,
out V  value 
)
inlinestatic

Same as IDictionary.TryGetValue() except that this method does not throw an exception when key==null (it simply returns false).