还是记录一下吧,好记性不如烂笔头。
1、静态的 using 声明
静态的 using 声明允许条用方法时候不适用类名。
C# 5:
using System;
//etc
Console.WriteLine("Hello,World!");
C# 6:
using static System.Console;
//etc.
Writeline("Hello,World");
2、表达式体方法
表达式体方法只包括一个可以用 lambda语法编写语句:
C# 5:
public bool IsSquare(Rectangle rect)
{
return rect.Height == rect.Width;
}
C# 6:
public bool IsSquare (Rectangle rect) => rect.He