M
Michael Schollmeyer
Hello,
The following code writes the text string:
Uri uri1 = new Uri("http://www.here.net/aplace?param=one");
Uri uri2 = new Uri("http://www.here.net/aplace?param=two");
int h1 = uri1.GetHashCode();
int h2 = uri2.GetHashCode();
bool e = uri1.Equals(uri2);
if (e == true && h1 != h2)
{
System.Console.WriteLine("Is is a bug or is it a feature?");
}
I thought the hash codes must be the same when two instances are equal. BTW,
I found this because Uri's seem to be unusable as keys in a hashtable.
I am using the following versions:
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Cheers,
Michael
The following code writes the text string:
Uri uri1 = new Uri("http://www.here.net/aplace?param=one");
Uri uri2 = new Uri("http://www.here.net/aplace?param=two");
int h1 = uri1.GetHashCode();
int h2 = uri2.GetHashCode();
bool e = uri1.Equals(uri2);
if (e == true && h1 != h2)
{
System.Console.WriteLine("Is is a bug or is it a feature?");
}
I thought the hash codes must be the same when two instances are equal. BTW,
I found this because Uri's seem to be unusable as keys in a hashtable.
I am using the following versions:
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Cheers,
Michael