相关疑难解决方法(0)

可空类型如何在C#中工作?

'int?'之间的幕后差异是什么?和'int'?'int?' 某种程度上是一种参考类型?

c#

20
推荐指数
2
解决办法
2万
查看次数

int的解释?vs int

可能重复:
'int?'之间有什么区别?和C#中的'int'?

我在C#中遇到了一些声明变量的代码: int? number

?意味着什么,以及它与以下内容有何不同:int

c# variables nullable

13
推荐指数
3
解决办法
2万
查看次数

检查integer == null

我想检查我的Listentry是否为null但我不知道如何.

注意:ID是整数

这是我的代码

if(MeineGaeste[i].ID !=null)
{
    i++;
}
else
{
    MeinGast.ID = i++;
    test = false;
}
Run Code Online (Sandbox Code Playgroud)

c# null integer if-statement

1
推荐指数
3
解决办法
3万
查看次数

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# ×4

if-statement ×1

integer ×1

null ×1

nullable ×1

variables ×1