469,948 Members | 2,911 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,948 developers. It's quick & easy.

IsNothing

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

Thanks in advance for your assistance!!!!!!!!!
Nov 15 '05 #1
5 20070
null ?

if (someRefType == null)
{
blah blah yackey smacky bork bork;
}
"Jim Heavey" <Ji*******@nospam.com> wrote in message
news:Xn*********************************@207.46.24 8.16...
I am trying to transition from VB.Net - what is the equivalent if the
IsNothing()?

Thanks in advance for your assistance!!!!!!!!!

Nov 15 '05 #2
if(myObject == null)

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Jim Heavey" <Ji*******@nospam.com> wrote in message
news:Xn*********************************@207.46.24 8.16...
I am trying to transition from VB.Net - what is the equivalent if the
IsNothing()?

Thanks in advance for your assistance!!!!!!!!!

Nov 15 '05 #3
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!
************************************************** ********************
"Jim Heavey" <Ji*******@nospam.com> wrote in message
news:Xn*********************************@207.46.24 8.16...
I am trying to transition from VB.Net - what is the equivalent if the
IsNothing()?

Thanks in advance for your assistance!!!!!!!!!

Nov 15 '05 #4
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
"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:Od**************@tk2msftngp13.phx.gbl...
if(myObject == null)

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Jim Heavey" <Ji*******@nospam.com> wrote in message
news:Xn*********************************@207.46.24 8.16...
I am trying to transition from VB.Net - what is the equivalent if the
IsNothing()?

Thanks in advance for your assistance!!!!!!!!!


Nov 15 '05 #5
JessCurious <Je*********@spamex.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Steve Peterson | last post: by
4 posts views Thread by tinman | last post: by
8 posts views Thread by MattB | last post: by
2 posts views Thread by Brian Linden | last post: by
4 posts views Thread by Dave Taylor | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.