Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • 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