{
if (obj.IsNullable())
{
var type = Nullable.GetUnderlyingType(typeof(T));
var result = obj == null ? FSharpOption
return result;
}
else
{
var result = obj == null ? FSharpOption
return result;
}
}
public static bool IsNullable
{
if (obj == null)
return true;
Type type = typeof(T);
if (!type.IsValueType)
return true; //ref type
if (Nullable.GetUnderlyingType(type) != null)
return true; // Nullable
return
false; // value-type
}
No comments:
Post a Comment