Retuns DBNull if Key is not found in the dictionary

Niladri.Biswas
Posted by Niladri.Biswas under C# category on | Points: 40 | Views : 1045
public static object GetDBValue<TKey, TSource>(this IDictionary<TKey, TSource> dict, TKey key)
{
if (dict.ContainsKey(key))
return dict[key];
else
return DBNull.Value;
}

Comments or Responses

Login to post response