Re: Check for null object



What do you mean it doesn't work? That is indeed the correct way to
check for null.

However, I suspect you are getting a compiler error telling you that the
test variable is not initialized. You might want to fix that first.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"Tarun Mistry" <nospam@xxxxxxxxxx> wrote in message
news:%23TNVbwB3GHA.2196@xxxxxxxxxxxxxxxxxxxxxxx
Hi guys,

what is the best/correct way to check for a NULL object?

I.e.

myClass test;

if(test == null) {}

This doesnt work.

Thanks
Taz



.



Relevant Pages