0

There seem to be a lot of equation interfaces: IEquatable, IEquatable<T>, IEqualityComparer, IEqualityComparer<T>. Which one should I implement to be able to detect if two objects have the same value (while my object decides what the same value means).

And I want this to be possible not just for two objects of the known same type, but also for two objects of which one is my known type, and even for collections of two objects, even if they are of unknown origin, for instance IList and IEnumerable (both the not generic type, so without the <T>)

What is the proper way to do this?

shree.pat18
  • 21,449
  • 3
  • 43
  • 63
Harald Coppoolse
  • 28,834
  • 7
  • 67
  • 116
  • It's unclear what you mean by the second part of your question, to be honest. An example would help a lot. – Jon Skeet Aug 27 '14 at 14:39
  • 4
    http://stackoverflow.com/questions/9316918/what-is-the-difference-between-iequalitycomparert-and-iequatablet http://stackoverflow.com/questions/15797780/differences-between-iequatablet-iequalitycomparert-and-overriding-equals http://stackoverflow.com/questions/19671668/what-are-the-roles-of-iequalitycomparer-and-iequatable-in-the-enumerable-sequenc – Tim Schmelter Aug 27 '14 at 14:40

0 Answers0