This project is read-only.


Character comparison converts to Int32 values


If I have a comparison such as:
'a' == 'a'
The TypeInfo for both sides of this expression reports that the Type is Char and the ConvertedType is Int32. It seems like there should be no conversion here and ConvertedType should be Char as well.


nmgafter wrote Aug 9, 2014 at 8:37 PM

According to section 7.10.1 of the C# language specification, there is no == comparison between char values. They must first be converted to int values.