希望大家能耐心看看问题在回答  Asp.net 如何获取“(System.Nullable)Type”的真实类型
例子: public enum TypeEnum
    {
        type1=0,
        type2,
        type3
    } public class Model_Test
  {
      public TypeEnum? Type
        {
            set { _type = value; }
            get { return _type; }
        }
   }
//我想通过这种方式获取的值来判断这是一个Enum类型的属性
  PropertyInfo pro=typeof(Model_Test).GetProperty("Type")
  pro...
  .
  .求教高手

解决方案 »

  1.   

    System.Nullable<int> i = null; 
    Console.WriteLine( i.GetType());详细出处参考
      

  2.   


    GetType()  这个是能获取的出来。可是在反射的情况不知道到底会是什么类型。
    所以GetType() 用不起来。
      

  3.   

    表示可空类型nullable<> 或int?i=1;
      

  4.   

    获取所有枚举类型的值
    Array arr=Enum.GetValues(Typeof(枚举类型名称));
    然后再foreach()
      

  5.   

    // GetGenericArguments获取泛型参数表数组,重新设置类型
    Type type = property.PropertyType;
    if (type == typeof(Nullable<>))
    {
        type = type.GetGenericArguments()[0];
    }
      

  6.   

    // GetGenericArguments获取泛型参数表数组,重新设置类型
    Type type = property.PropertyType;
    if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
    {
      type = type.GetGenericArguments()[0];
    }