Is it possible to create a method that takes a boxed value type and returns whether that value type is equal to the default for that type?
So I want to create a method with the following signature:
bool IsDefault(object boxedValueType);
Note: the following code will not work as T gets set to type object so default(T) will always be null.
bool IsDefault<T>(T input)
{
return Equals(input, default(T));
}
With reflection, but it’s a slow method