char

suggest change

A char is a UTF-16 code unit, often a single character, stored in a variable. It is a built-in value type that takes two bytes. It represents the System.Char type.

There are multiple ways to do this.

  1. char c = 'c';
  2. char c = '\u0063'; //Unicode
  3. char c = '\x0063'; //Hex
  4. char c = (char)99;//Integral

A char can be implicitly converted to ushort, int, uint, long, ulong, float, double, or decimal. The conversion uses the character's numeric code unit.

char c = 'c';
ushort u = c;

returns 99 etc.

There are no implicit conversions from other types to char. You must cast them.

ushort u = 99;
char c = (char)u;

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents