CSharp examples for System.Collections.Generic:IDictionary
Get Or Default from IReadOnlyDictionary
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*ww w .j a va 2s. c o m*/ public class Main{ public static TValue GetOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> source, TKey key) { TValue value; if (source.TryGetValue(key, out value)) { return value; } return default(TValue); } }