Reputation: 7596
So I want an array of char object similar to this:
char[] allowedCharactersUnreserved = new char[] {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_', '.'
};
Problem is saving the: ' element
char[] allowedCharactersReserved = new char[] {
'#', '[', ']', ''' <---- problem
};
I get an "empty character literal" error
Upvotes: 1
Views: 6804
Reputation: 2151
its better to use
char[] allowedCharactersUnreserved =
@"ABCDEFGHIJKLMNOPQRSTUVWXYZabc'[]""#".ToCharArray(); //where ("") char is (")
Upvotes: 2
Reputation: 54897
You need to escape it using a backslash: '\''
. It's the same as you would do to escape "
in a string: "\""
.
Upvotes: 2