I am trying to implement Nullable type. But below mentioned code doesn\'t support null value for valuetype datatypes.
using System;
using System.Runtime;
using S
You are declaring your homegrown Nullable as a struct
, and a struct
is not nullable.
You should declare it as a class
instead.
this code should throw the same error you are having,
switching the Point type declaration from struct
to class
should fix it.
void Main()
{
Point p = null;
}
// Define other methods and classes here
struct Point
{
public int X {get; set;}
public int Y {get; set;}
}