Why is string.Empty readonly? [duplicate]
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"?
精彩评论