|
CollectionExtensionsGetOrDefaultTKey, TValue(IDictionaryTKey, TValue, TKey) Method
|
Attempts to get the value for the given key and returns the default value instead if the key does not exist in the
IDictionaryTKey, TValue.
Namespace: GSF.CollectionsAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.218-beta+101eee949414e414795e55a6e73d88938f0177b8
Syntax public static TValue GetOrDefault<TKey, TValue>(
this IDictionary<TKey, TValue> dictionary,
TKey key
)
public:
[ExtensionAttribute]
generic<typename TKey, typename TValue>
static TValue GetOrDefault(
IDictionary<TKey, TValue>^ dictionary,
TKey key
)
JavaScript does not support generic types or methods.
View SourceParameters
- dictionary IDictionaryTKey, TValue
- The dictionary to check for the given key.
- key TKey
- The key to be checked for the existence of a value.
Type Parameters
- TKey
- The type of the keys in the dictionary.
- TValue
- The type of the values in the dictionary.
Return Value
TValueThe value of the key in the dictionary or the default value if no such value exists.
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