[Mono-dev] Socket has a dynamic GetHashCode method

David Wolinsky davidiw at ufl.edu
Mon Aug 13 13:28:47 EDT 2007

Socket relies on the underlying operating system handle for its 
HashCode, this creates a problem if later after the underlying resource 
has been disposed but the Socket object is still in use....

For example...

Hashtable ht = new Hashtable();
Socket s = new Socket(...);
ht[s] = 5;
Console.WriteLine(ht.Contains(s)); // true
Console.WriteLine(ht.Contains(s)); // false

Is this a bug or an expected result?


More information about the Mono-devel-list mailing list