Check if object is null using ReferenceEquals object static method

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 327
ReferenceEquals - >Determines whether the specified System.Object instances are the same instance.
public bool IsNull(object obj)
{
return object.ReferenceEquals(obj, null);
}


To test above method:-
string st = null;
Response.Write(IsNull(st) + "<br/>");
True
st = "1";
Response.Write(IsNull(st) + "<br/>");
False

Comments or Responses

Login to post response