Quantcast
Channel: Ashish Khandelwal
Viewing all articles
Browse latest Browse all 100

string.GetHashCode() and HashTable calls GetHashCode() Differ?

$
0
0
—–See below code, string str = “blair”; string strValue = “ABC”; string str1 = “brainlessness”; string strValue1 = “XYZ”; int hash = str.GetHashCode() ; // Returns 175803953 int hash1 = str1.GetHashCode(); // Returns 175803953 Hashtable ht = new Hashtable(); ht.Add(hash ,strValue); ht.Add(hash1,strValue1); // ****ERROR**** string strTmp = (string) ht[str]; string strTmp1 = (string) ht[hash1]; In [...]

Viewing all articles
Browse latest Browse all 100

Trending Articles