Your inclination is correct, and you have nothing to worry about wrt objects overriding == and tests for null references.
"!= null" and "== null" are syntactic sugar. No methods are invoked on any object for these particular tests, as you are just testing whether the address stored in the xyz variable is a 0 or not. (0 == null pointer == null reference == Nothing). I never did understand why the VB designers didn't do the same thing, but instead came up with the double negative, unintuitive, "Not someObject Is Nothing" thingy. Not to be confused with the IsNull() method, or the IsEmpty() method. Just another reason C# is so much easier to learn than VB. ;-) Keep Smilin' Ed Stegman -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of David Ferguson Sent: Saturday, May 04, 2002 12:06 PM To: [EMAIL PROTECTED] Subject: What is the correct way to test for Is Nothing in C#? In VB I would say... if (Not xyz Is Nothing) In C# I am inclined to say... if (xyz != null) but I am concerned that an object might override operator !=. What is the recommended way to do this test in C#? Thanks...David You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.