所以我有我的case函数,并且我一直都收到此错误。我究竟做错了什么? 我想念什么?
每个case语句之后,错误始终发生。
private string GetData(Type DotNetType) {
switch (true) {
case DotNetType.Equals(typeof(TimeSpan)): //here
return "timespan";
break;
case (DotNetType == typeof(DateTime)): //here
return "datetime";
break;
case (DotNetType == typeof(Decimal)): //here
return "number";
break;
case (DotNetType == typeof(int)): //here
return "number";
break;
case (DotNetType == typeof(double)): //here
return "number";
break;
case (DotNetType == typeof(float)): //here
return "number";
break;
case (DotNetType == typeof(System.Drawing.Bitmap)): //here
return "image";
break;
case (DotNetType == typeof(byte[])): //here
return "binary";
break;
case (DotNetType == typeof(bool)): //here
return "flag";
break;
default:
return "text";
break;
}
}