小编alx*_*xem的帖子

C#不能隐式转换类型'int?' 'int'

我有这个问题:

int cid =  (from c in dc.Cs
                where c.id == cid
                select c.clientid).FirstOrDefault();

return cid;
Run Code Online (Sandbox Code Playgroud)

其中c.clientid可以为空.但我收到这个错误:

无法隐式转换类型'int?' 'int'.存在显式转换(您是否错过了演员?)

c#

0
推荐指数
1
解决办法
3599
查看次数

标签 统计

c# ×1