I have 4 classes that implement IStatus... InvoiceNote, InvoiceStatus,
PurchaseOrderStatus and PurchaseOrderNote.
Here's the problem, I have 2 PurchaseOrder objects, po1 and po2.
When I do
bool val = (po1.Status == po2.Status).
it seems to do a reference check instead of use the == operator, or the
Equals method of the po1.Status.
I've overriden the Equals method and the == and != operator in all of the
classes. My understanding is, it would use the == operator of the object
returned by po1.Status.
I think that you should have your objects implement the IComparable
interface as well, or have your IStatus interface derive from IComparable
and use the CompareTo method for your comparisons.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"test account" <bitcha...@hax0r.dyndns.org> wrote in message
news:OAVeyVh2...@TK2MSFTNGP12.phx.gbl...
Thx
I could do that too, but I use that for sorting and not all of my classes
implement IComparable. All my classes override both the equality operators
and the equals operator, I didn't overide the gethashcode even though the
compiler complains about it. What I will do though is use the Equals method.
"Nicholas Paldino [.NET/C# MVP]" <m...@spam.guard.caspershouse.com> wrote in
message news:%23ihXzeh...@TK2MSFTNGP10.phx.gbl...