Re: Key compare in Dictionary
Ryan Heath <[email protected]> Fri, 21 May 2010 09:26:54 +0200
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
I have found this documentation http://msdn.microsoft.com/en-us/library/xfhwa508.aspx It vaguely words that a hash is required for the key class. Perhaps it should be stated more firmly that equal keys *must* have equal hashes, thus Object.GetHashCode *must* be overridden when implementing IEquatable or when overriding Object.Equals. At least the C# compiler warns with "'xxx' overrides Object.Equals(object o) but does not override Object.GetHashCode()" ... // Ryan On Fri, May 21, 2010 at 8:31 AM, Mark Hurd <[email protected]> wrote: > On Thu, May 20, 2010 at 8:51 PM, David Nicholson <[email protected]> wrote: >> That was it. >> >> Thanks >> David. > > Does that suggest a DocErr where it says Implementing IEquatable(Of T) > is enough for it to be used? > > -- > Regards, > Mark Hurd, B.Sc.(Ma.)(Hons.) > > =================================== > View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives > =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives