开发者

Why is string.Empty readonly? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Why isn't String.Empty a constant?

...and not const?

I know its probably a useless question, but I'm sort of curious on the reasoning behind this one. An empty string is an empty string so I do not foresee many chances of string.Empty being anything else than "". So why make it readonly?

Is the开发者_运维问答re any other benefit I'm missing in not making it const?


It IS static.

public static readonly string Empty;


Readonly prevents it from being changed. Perhaps you mean "why isn't it a const"?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜