char
suggest changeA char is single letter stored inside a variable. It is built-in value type which takes two bytes of memory space. It represents System.Char
data type found in mscorlib.dll
which is implicitly referenced by every C# project when you create them.
There are multiple ways to do this.
char c = 'c';
char c = '\u0063'; //Unicode
char c = '\x0063'; //Hex
char c = (char)99;//Integral
A char can be implicitly converted to ushort, int, uint, long, ulong, float, double,
or decimal
and it will return the integer value of that char.
ushort u = c;
returns 99 etc.
However, there are no implicit conversions from other types to char. Instead you must cast them.
ushort u = 99;
char c = (char)u;
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents