How to write an extension method that should check value of the object,if object is null then it should return null otherwise value{without doing casting at receiving end}.
something like...
public static object GetDefault(this object obj)
{
if (obj == null) return null;
else return obj;
}
I mean without casting can i check for null?
int? a=a.GetDefault();
ContactType type=type.GetDefault(); [For EnumType]
string s=a.GetDefault()