CSharp · Console
using System;
namespace Program
{
public class Program
{
public static void Main(string[] args)
{
Nullable<int> i = 5;
Console.WriteLine(i.GetType());
OwnNullable<int> j = 6;
Console.WriteLine(j.GetType());
}
}
}
struct OwnNullable<T>
where T : struct
{
private T field;
public OwnNullable(T value)
{
field = value;
}
public static implicit operator OwnNullable<T>(T value)
{
return new OwnNullable<T>(value);
}
}