given a class definition like:
public class Test<T>
{
T _value;
public void Test(T value)
{
_value = value;
}
public void DoStuff()
{
if(_value.HasValue)
{
//stuff
}
}
}
I would like to enforce that T is nullable so I can use the class like:
//does stuff
new Test<int?>(3).DoStuff();
//doesn't do stuff
new Test<int?>(null).DoStuff();