我想要做的是像这样的事情:
switch( myObject.GetType().GetProperty( "id") )
{
case ??:
// when Nullable<Int32>, do this
case ??:
// when string, do this
case ??:
// when Nullable<bool>, do this
在object.GetType()下,哪个路径会有数据类型的字符串名称,我可以使用case语句进行比较? 我需要知道类型,以便使用反射中的多个Convert.ToInt32(string)之一设置myObject的值。