日期:2014-05-17  浏览次数:20356 次

cid = (string.IsNullOrEmpty(typeId) ? null : ( Convert.ToInt32( typeId)) ) 有

        @{var typeId = Request.QueryString["cid"];
          int? cid;
         cid = (string.IsNullOrEmpty(typeId) ?  null : ( Convert.ToInt32( typeId)) );
}


( Convert.ToInt32( typeId)) )   这一块下边出现红线,显示有错,该怎么写

因为有个函数里边有个 类型就是 int ?,所以我进行上边转换

------解决方案--------------------
try

 cid = string.IsNullOrEmpty(typeId) ?  null : (int?) Convert.ToInt32( typeId);