在使用DataRow读取数据时,通常会遇到数据可能为Null, 但是又需要转换为如int等其它类型的数据,因此就通常会写这样的代码: if (dr[name] != DBNull.Value && dr[name] != null){ if (!int.TryParse(dr[name].ToString(), out result)) throw new Exception("整形转换失败");} 而且这样的代码通常会大段大段出现在很多地方.对于比
一:数字 int int(整型): 在32位机器上,整数的位数为32位,取值范围为-2**31-2**31-1,即-2147483648-2147483647 在64位系统上,整数的位数为64位,取值范围为-2**63-2**63-1,即-9223372036854775808-9223372036854775807 class int(object): """ int(x=0) -> int or long int(x, base=10) -> int or l