What is the best way to determine whether an object reference variable is null?
Is it the following?
MyObject myObjVar = null;
if (myObjVar == null)
{
// do stuff
}
What is the best way to determine whether an object reference variable is null?
Is it the following?
MyObject myObjVar = null;
if (myObjVar == null)
{
// do stuff
}
In C# 7.0 you can use is null:
MyObject myObjVar = null;
if (myObjVar is null)
{
// do stuff
}