相关疑难解决方法(0)

使用.Net,如何确定类型是否为数值ValueType?

但这是一个例子:

Dim desiredType as Type
if IsNumeric(desiredType) then ...
Run Code Online (Sandbox Code Playgroud)

编辑:我只知道类型,而不是字符串的值.

好的,不幸的是我必须循环使用TypeCode.

但这是一个很好的方法:

 if ((desiredType.IsArray))
      return 0;

 switch (Type.GetTypeCode(desiredType))
 {
      case 3:
      case 6:
      case 7:
      case 9:
      case 11:
      case 13:
      case 14:
      case 15:
          return 1;
 }
 ;return 0;
Run Code Online (Sandbox Code Playgroud)

.net reflection

48
推荐指数
6
解决办法
3万
查看次数

标签 统计

.net ×1

reflection ×1