By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,231 Members | 1,613 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,231 IT Pros & Developers. It's quick & easy.

Check to see if object instance exists

P: n/a

Thanks in advance.
what is the C# equivalent of the VB.net IsNothing(object) function?
just trying to check to see if an object instance already exists.
does someone have an example?
*** Sent via Developersdex http://www.developersdex.com ***
Feb 21 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Larry <la***@nospamhere.comwrote:
Thanks in advance.
what is the C# equivalent of the VB.net IsNothing(object) function?
just trying to check to see if an object instance already exists.
does someone have an example?
Well, if what you mean is that you want to see if the value of a
variable refers to an object or not, you want:

if (x==null)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 21 '07 #2

P: n/a
On Feb 21, 6:33 pm, Larry <l...@nospamhere.comwrote:
Thanks in advance.
what is the C# equivalent of the VB.net IsNothing(object) function?
just trying to check to see if an object instance already exists.
does someone have an example?

*** Sent via Developersdexhttp://www.developersdex.com***
It's quite easy: you just compare to "null"

object someobject;
someobject = someMethod();
if (someobject == null)
{
// if it's null, then what?
}

Does that solve your problems?

--Freiddy
http://fei.yuanbw.googlepages.com/

Feb 21 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.