随笔分类 -  开发 / C#

摘要:List<Customer> list = new List<Customer>();list.Add(new Customer { id = 1, name = "刘德华", age = 56, period=40 });list.Add(new Customer { id = 2, name = 阅读全文
posted @ 2024-01-25 14:00 apple-hu 阅读(7) 评论(0) 推荐(0) 编辑
摘要:?? 如果左边是的null,那么返回右边的操作数,否则就返回左边的操作数,这个在给变量赋予默认值非常好用。 int? a = null;int b = a ?? -1;Console.WriteLine(b); // output: -1 ??= 当左边是null,那么就对左边的变量赋值成右边的 i 阅读全文
posted @ 2023-12-15 10:32 apple-hu 阅读(20) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示