Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I check if an instance of an object is null

Status
Not open for further replies.

mit99mh

Programmer
Sep 24, 2002
246
GB
I'm using some objects in a web application - they are "saved" in the session and periodically removed. When an object has been removed if I try and reference a class method of the object that no longer exists I get a nullrefernce exception that I handle accordingly - Is there an easier way of doing this, for example checking that the instance of the object is nothing rather than handling the exception when one of its methods is called?

Any help appreciated.
 
in vb.net, you get microsoft.visualbasic imported by default.
This has an isnothing function

If you are using C#, you could import this library

Mark [openup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top