char + char = int? Why?

Accoding to the documentation of char it can be implicitly converted into integer values. The char type doesn’t define a custom operator + so the one for integers is used.

The rationale for there being no implicit conversion to string is explained well in the first comment from Eric Lippert in his blog entry on “Why does char convert implicitly to ushort but not vice versa?”:

It was considered in v1.0. The language design notes from June 6th
1999 say “We discussed whether such a conversion should exist, and
decided that it would be odd to provide a third way to do this
conversion. [The language] already supports both c.ToString() and new
String(c)”.

(credit to JimmiTh for finding that quote)

Leave a Comment