value-type、nullable value-type、enum、nullable-enum、リフレクションによる参照型の区別方法を教えてください。value-type、nullable value-type、enum、nullable-enum、リフレクションによる参照型を区別する方法は?
enum MyEnum
{
One,
Two,
Three
}
class MyClass
{
public int IntegerProp { get; set; }
public int? NullableIntegerProp { get; set; }
public MyEnum EnumProp { get; set; }
public MyEnum? NullableEnumProp { get; set; }
public MyClass ReferenceProp { get; set; }
}
class Program
{
static void Main(string[] args)
{
Type classType = typeof(MyClass);
PropertyInfo propInfoOne = classType.GetProperty("IntegerProp");
PropertyInfo propInfoTwo = classType.GetProperty("NullableIntegerProp");
PropertyInfo propInfoThree = classType.GetProperty("EnumProp");
PropertyInfo propInfoFour = classType.GetProperty("NullableEnumProp");
PropertyInfo propInfoFive = classType.GetProperty("ReferenceProp");
propInfoOne.???
...............
...............
}
}
ここで、これらの情報は取得できますか?
"基本タイプ"はどのように定義しますか? – CodesInChaos
int、float、double ........ MyClass-propsでわかるように。値の型。 – anonymous
カスタム構造体はどうですか?たとえば、列挙型を他の値型と区別する必要がある理由はわかりません。 – CodesInChaos