IsNothing

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

I am trying to transition from VB.Net - what is the equivalent if the
IsNothing()?

Thanks in advance for your assistance!!!!!!!!!
 
If you are testing:

If variableName Is Nothing Then

the equivalent is

if(variableName == null)
{
}

There is no direct, 100% equivalent of the function IsNothing, but the test
against null accomplishes the same thing.

NOTE: For some objects, there are IsNull() methods. For example, SQL data
types:

if(mySqlInt.IsNull())
{
}

You can also test a dataRow in this manner

if(myDataRow.IsNull())
{
}

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
i've sometimes had to use if (null == myObject), for instance strings were
broken in vs2002.

Does anybody have any comments on whether this should ever be necessary,
whether this should be the preferred style of IsNothing, etc??

TIA
 
JessCurious said:
i've sometimes had to use if (null == myObject), for instance strings were
broken in vs2002.

Well, they might have appeared broken in the debugger, but they did
actually work in .NET itself, AFAIK.
Does anybody have any comments on whether this should ever be necessary,
whether this should be the preferred style of IsNothing, etc??

I don't believe it should ever be necessary, and I personally don't
like it, but there we go.
 
Back
Top