C#英语笔记Day 23

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; }
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。