How to check whether object is initialized or not?

 Posted by vishalneeraj-24503 on 12/27/2013 | Category: ASP.NET Interview questions | Views: 1500 | Points: 40
Answer:

We can check with not null in C# and not nothing in VB.Net to check whether object is initialized or not

As

In C#:

Dataset ds = new Dataset();
if(ds!=null)
{
//read data from Dataset
}

In VB.Net
Dim ds as Dataset = Nothing
If(Not ds is Nothing)
{
//read data from Dataset
}


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response