473,395 Members | 1,972 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,395 software developers and data experts.

Check to see if object instance exists


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

Similar topics

6
by: Andre Meyer | last post by:
Hi all I have been searching everywhere for this, but have not found a solution, yet. What I need is to create an object that is an instance of a class (NOT a class instance!) of which I only...
1
by: KK | last post by:
Hi, How to set timeout for COM+ object instance? If any instance is running more than 15 minutes, I want COM+ application to kill the instance automatically. Is there any way to set this?
6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
4
by: Piotr Perak | last post by:
Can someone explain the "object instance" term that is used i many of C# books? I have C++ background. In C++ instance and object meant the same. I could say that I have object of some class or...
2
by: Andrzej Kaczmarczyk | last post by:
Hi, I have following problem: (warning, quite long post with lots of code) I have an object of a known type like this. class MyClass { public int Property1; public string Property2; }
11
by: syssyx | last post by:
I have a "CurrentUser" object in session that I want to access from each page of a vb.net website. I can successfully access everything if I include the following at the start of each pageload: ...
0
by: Alun Jones | last post by:
I'm getting the above error in a dialog box from Visual Studio 2005 when trying to sign an assembly using a PFX file, and would like to know how to resolve the problem. Background: The PFX...
59
oll3i
by: oll3i | last post by:
how to check if an object already exists and return reference to that object
8
by: stef mientki | last post by:
hello, I've written a convenience wrapper around ConfigObj (which is a imporved ConfigParser). Now if I use an instance of the base class, I can easily test is the instance exists by " if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.