Skip to content
CShift0.32

char

Struct · built-in type

struct char : IComparable<char>, IEquatable<char>, IHashable

A byte of text, a type of its own that converts implicitly to and from uint8 (and to the larger integer types). A character literal like 'a' is its ASCII code; arithmetic on it gives an int ('a' + 1 is 98).

A char is one byte of UTF-8, so a character beyond ASCII is several chars. The namespace Char classifies and converts them (Char.IsDigit(c)).

Name Description
ToString A string of the one character.
Equals Whether the characters are equal (also a == b).
CompareTo Compares the codes: -1, 0 or 1.
GetHashCode A hash code of the character, for Dictionary keys.
string ToString()

A string of the one character.

bool Equals(char other)

Whether the characters are equal (also a == b).

int CompareTo(char other)

Compares the codes: -1, 0 or 1.

int GetHashCode()

A hash code of the character, for Dictionary keys.