Sometimes while using ToString method for a object we end up in a situation where object is null and we get Null Exception. eg
Object 0 = null;
o.ToString();
In this case we can use if condition to check whether the object is null and then use ToString method.
if (o != null)
{
o.ToString();
}
Wednesday, October 8, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment