• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

object is null

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
jayrod
Asked:
jayrod
1 Solution
 
tinchosCommented:
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
 
psdavisCommented:
if( myObj == null )
...
0
 
ihenryCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now