about the object.Equals method

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Hello!

If you have two structs lets call them structA and structB which are value
types you can compare if the contents is the same for
structA and structB by using the Equals that are overloaded in the
System.ValueType class.

Now to my question why is not the default implemented for Equals made in the
same way for reference type as for value types to compare for equality of
the contents of the object. The default implamentation is comparing
references. I know I can override the virtual Equals and make the
implamantation for value comparison of two object.

//Tony
 
Back
Top