c# 7.0 學習筆記
阿新 • • 發佈:2017-10-27
ole action zed val struct amp ret null int
out 可以寫在裏面了
// int result = 0; 不需要寫在外面了
if (!int.TryParse(input, out int result)) { return null; } return result;
Local functions, 終於有了, 寫習慣 js 的我超愛
[Route("")] public async Task<IActionResult> Index() { string abc = dada(); string dada() { return "a"; } }
getter setter
// Expression-bodied constructor public ExpressionMembersExample(string label) => this.Label = label; // Expression-bodied finalizer ~ExpressionMembersExample() => Console.Error.WriteLine("Finalized!"); private string label; // Expression-bodied get / set accessors. public string Label {get => label; set => this.label = value ?? "Default label"; }
c# 7.0 學習筆記