I have an Extension Method as mentioned below.Is there a way were I can make it work in a generic way.For int?,decimal?,long?,double?.Or is there a limitation in the way 0(zero) is compared for different numeric data type?
public static bool IsNotNullAndGreaterThanZero(this decimal? value)
{
return (value ?? 0M) > 0M;
}
Well, you could do this:
That uses the fact that for most value types, the default value is the “natural zero”.