c# - 私有(private)诠释? _城市_Id;谁能告诉我 "?"在这里是什么意思

标签 c# types

私有(private)整数? _City_Id;

最佳答案

在不知道您要回复的目标语言的情况下,在 C# 2.0? 表示可为 null 的值类型。

Nullable value types (denoted by a question mark, e.g. int? i = null;) which add null to the set of allowed values for any value type.

正如 Calum 指出的那样(所有功劳都归功于他),这意味着可以为变量分配 null。通常像 intdouble 这样的基元不能为空,

int? x = 10;
double? d = 4.108

关于c# - 私有(private)诠释? _城市_Id;谁能告诉我 "?"在这里是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2691088/

相关文章:

c# - 如何从后台 worker 将文本设置为 TextBlock

c# - .NET 中的时区问题

c++ - 模板类的成员函数,将模板类型作为参数

c++ - 为什么 INT_MIN 的绝对值与 INT MAX 不同?

python - np.array arr.itemsize 与 sys.getsizeof(arr[0])

typescript - 在 typescript 中缩小对象属性类型的干净方法

haskell - 为什么 Haskell 不允许更复杂的中缀表达式?

c# - 如何从 visual studio 2013 中禁用 mscorlib.dll?

c# - 使用 DependencyProperty 在 CustomControl 中绑定(bind) ComboBox 的 SelectedItem 的问题

c# - jquery 窗口值在 ASP.NET 代码后面无法访问