If i have a complex object, what is the best practice pattern to write code to compare 2 instances to see if they are the same
Implement the IEquatable interface. This defines a generalized method that a value type or class implements to create a type-specific method for determining equality of instances. Don't forget to override Equals(object) as well. More information here:
http://msdn.microsoft.com/en-us/library/ms131187.aspx
2.1m questions
2.1m answers
60 comments
57.0k users