C#6.0新特性笔记 Getter专属赋值 可以在构造函数中,给只有get的属性赋初始值. class Point { public int x { get; } public Point() { x = 1; } } 自动属性初始化 可以给自动属性,赋初始化值 class Point { public int x { get; set; } = 1; } 全局静态 可以设置全局静态,然后直接写静态类的方法. using static System.Console; namespace FxAp…
1.可选链操作符 // oldlet ret = obj && obj.first && obj.first.second// newlet ret = obj?.first?.second 2.空位合并操作符 // oldlet c = a ? a : blet c = a || b// new 如果表达式在??的左侧运算符求值为 undefined 或 null,就返回其右侧默认值. (0, false 标示有效值)let c = a ?? b 3.Promise.al…