Solved

object is null

Posted on 2004-08-09
3
307 Views
Last Modified: 2010-04-15
I would like to know if there is a method or something that I could inherit that would tell me if my object is null or not?  i.e. all of the properties are empty and have not been set.
0
Comment
Question by:jayrod
3 Comments
 
LVL 9

Expert Comment

by:tinchos
ID: 11756430
If an object is null, you cannot access its methods, properties or attributes

In order to know if an object is null you would do

object myObj;

// Code

if( myObj is null )
{
    // myObj is null
}
else
{
    // myObj is not null
}

Hope this helps

Tincho
0
 
LVL 7

Expert Comment

by:psdavis
ID: 11756661
if( myObj == null )
...
0
 
LVL 20

Accepted Solution

by:
ihenry earned 250 total points
ID: 11759618
I'm not sure I understand your problem, but maybe you can use this

INullable Interface
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataSqlTypesINullableClassTopic.asp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now