如果C#允许一个?? =运算符,那将是非常好的.我发现自己经常写下面的内容:
something = something ?? new Something();
我宁愿这样写:
something ??= new Something();
思考?新的语言扩展总是存在争议的本质.
c# language-features operators null-coalescing-operator
c# ×1
language-features ×1
null-coalescing-operator ×1
operators ×1