crazyboybert
Programmer
Hi All
I want to compare two objects of the same type to test for value equality. I can't do this with Equals(object, object), object.Equals(object) or == as these all test for reference equality only.
I can see two options for performing this type of comparison. I can either override the Equals method for the object to specify a value comparison, or implement the IComparable interface and use the CompareTo method to provide a value comparison.
The thing is I have several classes I wish to be able to perform this type of comparison on and they all have multiple value properties to test. This adds up to a fair bit of work and I was hoping (probably fruitlessly I admit) that someone would have a quicker solution to anabling a value comparison.
Thanks
Rob
Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
I want to compare two objects of the same type to test for value equality. I can't do this with Equals(object, object), object.Equals(object) or == as these all test for reference equality only.
I can see two options for performing this type of comparison. I can either override the Equals method for the object to specify a value comparison, or implement the IComparable interface and use the CompareTo method to provide a value comparison.
The thing is I have several classes I wish to be able to perform this type of comparison on and they all have multiple value properties to test. This adds up to a fair bit of work and I was hoping (probably fruitlessly I admit) that someone would have a quicker solution to anabling a value comparison.
Thanks
Rob
Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927