0

Possible Duplicate:
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 ?

Community
  • 1
  • 1
pencilCake
  • 48,449
  • 79
  • 219
  • 356

3 Answers3

4

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

You can try using "null" character:

char empty = '\0';
Shadow Wizard Says No More War
  • 64,101
  • 26
  • 136
  • 201
4

You can use for identifying empty char:

default(Char)
Samich
  • 28,257
  • 5
  • 65
  • 76
2

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

char? c = null;
David Heffernan
  • 587,191
  • 41
  • 1,025
  • 1,442