可能重复:
Nullable type is not a nullable type?
How to check if an object is nullable?
请参阅以下代码。有没有办法通过传递n作为参数来获得类似System.Nullable`1 [System.Int32]的东西?
static void Test()
{
List<int> l = new List<int>();
Nullable<int> n = new Nullable<int>( 1 );
Console.WriteLine( l.GetType() ); // will output System.Collections.Generic.List`1[System.Int32]
Console.WriteLine( n.GetType() ); // will output System.Int32. Why won't output something like System.Nullable`1[System.Int32] ?
}