我有一个枚举,我想检查枚举类型是否为ulong.
到目前为止尝试过:
 var checkValue = Enum.GetUnderlyingType(param.ParamType); // param is enum
 if (checkValue is ulong){ } // doesn't work
 var checkValue = param.value;
 if (checkValue is ulong){ } // doesn't work
有任何想法吗?
Enum.GetUnderlyingType返回一个类型为的对象Type,它确实不是一个ulong,它是ulong类型本身:)
试试这个:
if (checkValue == typeof(ulong))