about the object.Equals method

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top