IsDefaultForType
Returns true or false depending on if the given object is equal to the default(T) value of the type.
Source
public static bool IsDefaultForType<T>(this T val)
{
return EqualityComparer<T>.Default.Equals(val, default(T));
}
Example
var obj = SomeComplexFunction();
if(obj.IsDefaultForType())
{
RunSomethingElse();
}