public static class DictionaryExtension
{ /// <summary>
/// try to get value according to Key, then get a direct return value, you do not get a direct return null
/// the this the Dictionary <TKEY, TValue> dict H to get the dictionary to express our dictionary value
///
public static Tvalue TryGet<Tkey, Tvalue>(this Dictionary<Tkey, Tvalue> dict, Tkey key)
{
Tvalue value;
dict.TryGetValue(key,out value);
return value;
}
}
The this keyword followed by the class, all objects of this class can use this method