Hi,

I'm in the process of learning C#. Coming from C++, I'm used to getting some methods for free from the compiler, most notably an equality operator (that tests equality of all fields) and a copy constructor.

In C#, it seems I have to write these methods myself, except if I use structs instead of classes, where equality and copying are automatically defined. However, since everyone seems to recommend against using structs in most cases, I wonder if it is possible to get anything similar with classes. That is, can I in any way instruct the compiler to make a default Equals method and copy constructor for my class?

Henrik