1.词汇
- variable 变量
- property declarations 属性声明
- syntactic sugar 语法糖
- nullable types 可空类型
2.例句
-
you can solve the problem by adding a single character in the variable and property declarations.
在变量和属性声明中间添加一个字符?就解决了这个问题。
-
.NET 2.0 makes matters a lot simpler by introducing the Nullable<T> structure, and C# 2 provides some additional syntactic sugar。
.Net 2.0引入了Nullable<T>结构,C# 2 提供了一些语法糖,让事情变得特别简单。
-
The meaning of the null changes from “a special reference that doesn’t refer to any object” to “a special value of any nullable type representing the absence of other data,” where all reference types and all Nullable<T>-based types count as nullable types.
null的含义从不指向一个对象的特定引用,转换为代表没有给出其他数据的任意可空类型的一个特殊值,其中所有引用类型和基于Nullable<T>的类型都被视作可空类型。
3.代码
- 引入?,解决值类型的null问题
decimal? price;
public decimal? Price
{
get { return price; }
private set { price = value; }
}