What does this error mean in this context?
if (value == null)
return "";
if (value is Nullable && ((INullable)value).IsNull) //error on this line
return "";
if (value is DateTime)
{
if (((DateTime)value).TimeOfDay.TotalSeconds == 0)
return ((DateTime)value).ToString ("yyyy-MM-dd");
return ((DateTime)value).ToString ("yyyy-MM-dd HH:mm:ss");
}
I searched but didn't get any information on this error. I am trying this on Mono (2.10.8.1). This is a project actually meant for Windows, but when I tried to compile it in Monodevelop, I got this error.
The problem is here:
if (value is Nullable
It thinks you're talking about the static class System.Nullable rather than the System.Nullable<T> struct.
Perhaps you meant:
if (value is INullable ...)
?
Note that if value is of compile-time type object, then it will never be a Nullable<T>, as boxing a null value would give a null reference, and boxing a non-null value would give a boxed value of the underlying type.
If you think there's still something else which you need to achieve, please specify what you're trying to do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With