Check to see if object instance exists

  • Thread starter Thread starter Larry
  • Start date Start date
L

Larry

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?
 
Larry said:
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)
 
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/
 
Back
Top