更新时间:2023-11-02 13:01:16
从 C# 2.0 编译器开始,无论如何,String.Empty
几乎没有什么意义,实际上在许多情况下它是一个悲观,因为编译器可以内联一些对 ""
的引用,但不能对 String.Empty
做同样的事情.
As of the C# 2.0 compiler, there is very little point to String.Empty
anyway, and in fact in many cases it's a pessimisation, since the compiler can inline some references to ""
but can't do the same with String.Empty
.
在 C# 1.1 中,避免创建大量包含空字符串的独立对象很有用,但那些日子已经一去不复返了.""
工作得很好.
In C# 1.1 it was useful to avoid creating lots of independent objects all containing the empty string, but those days are gone. ""
works just fine.