1 //1.集合初始化器 2 List<string> strs = new List<string> { "zhangsan", "lisi", "wangwu" }; 3 int[] numbers = { 1, 2, 8, 6, 9, 1 }; 4 5 //2.空合并运算符 6 string InputName = null; 7 InputName = "11"; 8 string name = InputName ?? "Unknown"; 9 10 //3.条件访问运算符 11 string text = "Key"; 12 int? length = text?.Length; 13 14 //4.字符串插值 15 string name1 = "zhangsan"; 16 int age = 30; 17 Console.WriteLine($"姓名:{name1},年龄:{age}"); 18 19 //5.Lambda表达式 20 List<int> list = new List<int> { 1, 2, 3, 4 }; 21 var result = list.Where(x => x > 3 && x < 5);