再一次问:"有没有一种更简单的内置方式来代替我的助手方法?"
因此,从一个可为null的类型中获取底层类型很容易,但是如何获取一个可为null的类型呢.网络类型?
所以我有
typeof(int)
typeof(DateTime)
System.Type t = something;
我想要
int?
DateTime?
或
Nullable<int> (which is the same)
if (t is primitive) then Nullable<T> else just T
有内置的方法吗?