Solved

object is null

Posted on 2004-08-09
3
310 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 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