Or is it always guaranteed to be positive for all possible Chars?
It's guaranteed to be non-negative.
char
is an unsigned 16-bit value.
From section 4.1.5 of the C# 4 spec:
The
char
type represents unsigned 16-bit integers with values between 0 and 65535. The set of possible values for thechar
type corresponds to the Unicode character set. Althoughchar
has the same representation asushort
, not all operations permitted on one type are permitted on the other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With