Class
DictionaryExtensions

Extension helpers for IDictionary<TKey, TValue> to simplify common lookups without exceptions.

Definition

Namespace:System.Collections.Generic

Assembly:Telerik.Windows.Documents.Core.dll

Syntax:

cs-api-definition
public static class DictionaryExtensions

Inheritance: objectDictionaryExtensions

Methods

GetValueOrNull<TKey, TValue>(IDictionary<TKey, TValue>, TKey)

Return the value for key, or null if absent, avoiding exceptions for missing keys.

Declaration

cs-api-definition
public static TValue GetValueOrNull<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) where TValue : class

Parameters

dictionary

IDictionary<TKey, TValue>

The dictionary.

key

TKey

The key.

Returns

TValue

The value associated with the specified key, or null if the key is not present.