Karen,
If you have a variable, you can just use the equality operator, like so:
// The variable declaration.
MyClass instance = ...
To check to see if the variable is null, you do this:
if (instance == null)
{
// Code that executes when a variable is null is put here.
}
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Karen Hill" <ka**********@yahoo.comwrote in message
news:11*********************@e3g2000cwe.googlegrou ps.com...
How does one check if an object's reference is null? I'd like to check
that rather than catch a nullreference exception.
thanks.