public static class IDictionaryExtensions
{
public static T GetValueOrDefault<K, T>(this IDictionary<K, T> dictionary, K key)
{
var value = default(T);
bool hasValue = dictionary.TryGetValue(key, out value);
if (hasValue) {
return value;
} else {
return default(T);
}
}
}