Chars
A char is a data type in C# which represents a single 16-bit Unicode
character.
Essentially, it stores a single character, such as a letter, digit, or symbol.
Examples of chars
Section titled “Examples of chars”'A''2''$''\n'(newline character)
Declaring and initializing chars
Section titled “Declaring and initializing chars”You can declare and initialize a char variable using single quotes:
char letter = 'A';char digit = '5';char symbol = '#';Char operations
Section titled “Char operations”Chars are really just a number under-the-hood, so you can do any normal maths operations on them:
char letterA = 'A'; // Unicode value 65char letterB = 'B'; // Unicode value 66int difference = letterB - letterA; // difference is 1or:
char letter = 'F';char lowercaseLetter = (char)(letter + 32); // 'f'