Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save defunkt/211492 to your computer and use it in GitHub Desktop.
Save defunkt/211492 to your computer and use it in GitHub Desktop.
public static V GetValueOrDefault<K, V>(this Dictionary<K, V> dic, K key, V defaultVal)
{
V ret;
return dic.TryGetValue (key, out ret) ? ret : defaultVal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment