Skip to content

Dictionary Extension Methods

OtisInf edited this page Feb 19, 2013 · 2 revisions

The following extension methods are defined for the Dictionary<TKey, TValue> type:

  • void AddRange<TKey, TValue>(Func<TValue, TKey> keyProducerFunc, IEnumerable<TValue> rangeToAdd).
    Adds the range rangeToAdd to the dictionary specified, using the Func keyProducerFunc to produce the key values. If the key already exists, the key's value is overwritten with the value to add.
  • TValue GetValue<TKey, TValue>(TKey key).
    Gets the value for the key from the dictionary specified, or null / default(TValue) if key not found or the key is null.

Clone this wiki locally