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:
It thinks you’re talking about the static class
System.Nullablerather than theSystem.Nullable<T>struct.Perhaps you meant:
?
Note that if
valueis of compile-time typeobject, then it will never be aNullable<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.