static void Main(string[] args) { //?表示值类型的可空操做符 int? a1 = null; DateTime? myDateTime = null; //三元(运算符)表达式(?:) int b = 0; int a2 = b > 0 ? 1 : 2; //空合并运算符(??),若是a1为null值,则a1的值为1 int a3 = a1 ?? 1; //NULL查看运算符(?.):假如对象为NULL,则不进行后面的获取成员的运算,直接回来NULL int?[] array1 = null; string data = array1?.FirstOrDefault()?.ToString(); Console.WriteLine(data); Console.ReadLine(); }