Hi,

as I understand it you may implement IEquatable for performance reasons (better than overriden Equals) but you don't have to. In any case you should override object.Equals AND object.GetHashCode because many collection classes (Dictionary comes to mind) will only work if GetHashCode is implemented to fit your Equals implementation (GetHashCode will be checked first - if this returns different numbers - as is likely if you have two different objects in memory - Equals will never be called and the objects will be regardes as different)

By on 4/17/2011 11:57 PM ()

Hi,

as I understand it you may implement IEquatable for performance reasons (better than overriden Equals) but you don't have to.

Thanks! So does this mean that the default implementation of IEquatable calls the non-generic Equals method? This in turn would mean that, if I implement IEquatable, I would also have to override the non-generic Equals, right?

By on 4/18/2011 1:08 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper