比初恋还甜的c#语法糖
比初恋还甜的c#语法糖前言持续收集和整理一些C#或甜或咸的语法糖,一些奇怪的冷知识,逆天的用法.
????????????有一堆用法,浅浅总结一些稍微有意思的
可为空的值类型在c#2.0中引入了可为空的值类型,在值类型后加?表示可为空.
12345678910111213141516171819202122int? a = null;int[]? b = null;int?[]? c = null;bool? boolVar = null;List<int>? list = null;List<int?>? list2 = null;var wtf = new int?[]?[]//甚至可以这么写???{ new int?[] { 1, 2, 3 }, null, new int?[] { 4, 5, null }};if(a.HasValue) Console.WriteLine(a.Value);if (a < 10) //(null < 10) = ...
HelloWorld!
Hello World!This is my first post on my new blog!
I hope you like it!
More about meI am a game developer and I love creating games. I also like to learn new technologies and share my knowledge with others.
For a long while, I have been Dreaming of creating a blog to share my thoughts and ideas with others. I finally decided to create my own blog and start writing.
I hope you enjoy my blog as much as I enjoyed creating it!
Thanks for reading!