Click or drag to resize
DictionaryExtensionsGetValueOrDefaultTKey, TValue Method (IDictionaryTKey, TValue, TKey)
Gets a value from a dictionary. If they value is not there, adds the default value to the dictionary and returns that. Not thread safe because it can add items to the dictionary.

Namespace: Bio.Util
Assembly: Bio.Core (in Bio.Core.dll) Version: 2.0.0.1 (2.0.0.1)
Syntax
public static TValue GetValueOrDefault<TKey, TValue>(
	this IDictionary<TKey, TValue> dictionary,
	TKey key
)
where TValue : new()

Parameters

dictionary
Type: System.Collections.GenericIDictionaryTKey, TValue
The dictionary
key
Type: TKey
The key of the value to retrieve.

Type Parameters

TKey
The type of the dictionary's key
TValue
The type of the dictionary's value

Return Value

Type: TValue
A value for this key.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDictionaryTKey, TValue. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also