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
chartype represents unsigned 16-bit integers with values between 0 and 65535. The set of possible values for thechartype corresponds to the Unicode character set. Althoughcharhas 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