c# - Check whether key/value pair exists in hashtable collection -
i have hastable
hashtable hash = new hashtable(); hash.add("a", "1"); hash.add("b","2"); hash.add("c","3"); hash.add("c","4"
now need check key = "c" , value= "3" combination exits in hashtable or not.
hash.containskey
value function cheks weather key exists or not , containsvalue
function checks weather value exists or not. if tried
if( hash.contains("c") && hash.containsvalue("3")) { // code heree }
than return true both "c,3" , "c,4" combinathion.
i need check key/value pair combination how can check ?
if(hash.containskey("c") && hash["c"] == "3") { }
Comments
Post a Comment