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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -