开发者

If there is string.Empty why there is not char.Empty? [duplicate]

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

Possible D开发者_开发问答uplicate:

Why is there no Char.Empty like String.Empty?

I want to pass an empty char as a method parameter and I was wondering why I cannot say

char.Empty

while C# allows me to specify string.Empty ?

If not do I have '' as the only option ?


There is no empty char same way there is no empty number.

You can try using "null" character:

char empty = '\0';


You can use for identifying empty char:

default(Char)


There is no such thing as an empty char. You would need to use nullable types to introduce that concept.

char? c = null;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜