If there is string.Empty why there is not char.Empty? [duplicate]
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;
精彩评论