DataTable的DT =新的DataTable();
dt.Columns.Add(新的DataColumn(gridColumn1的typeof(布尔)));
我期待此行的结果,包括对DataColumns类型(布尔)的信息:
?dt.Columns [0] .GetType()
解决方案
您想用什么这个属性是:
dt.Columns [0] .DataType
在数据类型
属性将设置为以下之一:
布尔
字节
字符
日期时间
十进制
双
INT16
INT32
Int64的
为SByte
单
串
时间跨度
UINT16
UInt32的
UINT64
DataColumn.DataType物业MSDN参考
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn(gridColumn1, typeof(bool)));
I was expecting the result of this line to include the info about the DataColumns Type (bool):
?dt.Columns[0].GetType()
解决方案
What you want to use is this property:
dt.Columns[0].DataType
The DataType
property will set to one of the following:
Boolean
Byte
Char
DateTime
Decimal
Double
Int16
Int32
Int64
SByte
Single
String
TimeSpan
UInt16
UInt32
UInt64
DataColumn.DataType Property MSDN Reference
上一篇:比较字符串空 - 为什么ReSharper的认为这始终是假的?字符串、ReSharper
下一篇:燕窝产量返回的IEnumerable< IEnumerable的< T>>与懒惰的评价懒惰、产量、评价、LT