首页
视频
资源
登录
雨雨雨雨辰
有个性,不需要签名
博主信息
排名
6
文章
6
粉丝
16
评论
8
文章类别
.NET
20篇
Python
6篇
CSS
0篇
sql
4篇
JS
4篇
other
1篇
notepad
0篇
Redis
1篇
Linux
0篇
Regex
1篇
test
0篇
.NET Core
2篇
其他
1篇
最新文章
最新评价
{{item.articleTitle}}
{{item.blogName}}
:
{{item.content}}
关于我们
ICP备案 :
渝ICP备18016597号-1
网站信息:
2018-2024
TNBLOG.NET
技术交流:
群号656732739
联系我们:
contact@tnblog.net
欢迎加群
欢迎加群交流技术
原
C#8.0 新语法特性 ??= [..]
3948
人阅读
2021/4/26 14:40
总访问:
223768
评论:
0
收藏:
0
手机
分类:
.NET
# C#8.0 部分语法特性 #### Null 合并赋值 ```c# List<int> numbers = null; int? i = null; numbers ??= new List<int>(); numbers.Add(i ??= 17); //i null 赋值为17 numbers.Add(i ??= 20); //i 为17 值不改变 Console.WriteLine(string.Join(" ", numbers)); // output: 17 17 Console.WriteLine(i); // output: 17 ``` ####索引和范围 ```c# string a1 = "123456"; string s = a1[..]; //123456 string s1 = a1[..3]; //123 string s2 = a1[3..]; //456 string s3 = a1[2..4]; //34 ```
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739
👈{{preArticle.title}}
👉{{nextArticle.title}}
评价
{{titleitem}}
{{titleitem}}
{{item.content}}
{{titleitem}}
{{titleitem}}
{{item.content}}