I just noticed the HashTable objects have a Contains and CotainsKey method, with same description. So are they just synonyms or is there som edifference behind the scenes
+8
A:
If you examine the code of Contains with reflector, you can see that it directly call ContainsKey.
The IL is:
.method public hidebysig newslot virtual instance bool Contains(object key) cil managed
{
.maxstack 8
L_0000: ldarg.0
L_0001: ldarg.1
L_0002: callvirt instance bool System.Collections.Hashtable::ContainsKey(object)
L_0007: ret
}
This translates to the following C#
public virtual bool Contains(object key)
{
return this.ContainsKey(key);
}
GvS
2010-04-07 08:53:34