On Friday, 25 May 2018 at 08:27:30 UTC, Dukc wrote:
[...]
result = (digit < 10? '0' + (char)digit: 'A' + (char)(digit -
[...]
Looks correct, right? Yes.
[...]
So, ~ may be a bit confusing for newcomers, but there is a
solid reason why it's used instead of +, and it's because they
have a fundamentally different meaning. Good work, whoever
chose that meaning!
Sorry, but the mistake here is the fact that you wrongly assume C
behavior in C#. Adding chars to an existing string will result in
a string as in the language specification. The same '+' operator
works also with multicast delegates and I doubt that you'll
expect something else than a multicast delegate as a result.