473,324 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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 20968
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Steve Peterson | last post by:
Hi - just a quick question. I was wondering which is the better "VB.Net" way - to use IsNothing or the Is Nothing in an If..Then statement For example: If IsNothing(myObject) then 'blah...
4
by: tinman | last post by:
Hi.... There appears to be another way of checking if an object IsNothing in ..NET.....was wondering if this approach is better than the classic VB6 way of checking Is Nothing ? Example...
8
by: MattB | last post by:
Hello. I have a vb.net (asp.net) application that uses ado.net datasets. At one point, I need to check a text field in a DataTable to see if there's any text in it before performing text operations...
2
by: Brian Linden | last post by:
I cache a ton of stuff, and my ASP.NET application works great....but...... When I am stress testing it I'll get the "Object reference not set to an instance of an object" every once in a...
4
by: Dave Taylor | last post by:
This is really not very important but something that I'm just curious about...which is faster to execute or are they the same: (1) If IsNothing(_myVar) Then ... or (2) If _myVar Is Nothing...
2
by: Renilkumar | last post by:
Hello, I have successfully migrated asp.net application built in VS2003/1.1 to VS2005/2.0 in my local machine. It runs good without any errors. However If I copy the application into the shared...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.