I have created my own class called Transaction.

I have overloaded the Equals and NotEquals functions so that I can
simply use == or != to compare 'Transactions'.

The problem I am faced with is that I cannot figure out how to account
for Null transactions.

If inside the Equals function I say:

public override bool Equals(Object obj)
{
   Transaction x = (Transaction) obj;

   if (this == null || x == null)
      return false;         // will never reach here, because the
above will continue to loop forever until i get a stack overflow
because it will recursively call Equals a billion times.

   // my normal comparison checks
}

If I try to look at a member variable to validate  (x.AcquirerRT ==
null)   i get an 'object not instantiated' error message.  Which makes
sense.


I understand what is going on, but I don't know how to get around it.
Any time I try to say "== null", I get a stack overflow.  So then how
can I check for null?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to