• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • 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

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

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