forum

Home / DeveloperSection / Forums / char char = int? Why?

char char = int? Why?

Royce Roy211306-Jun-2013
Hi All,

Why is adding two char in C# results to an int type?

For example, when I do this:

var pr = 'R' + 'G' + 'B' + 'Y' + 'P';
the pr variable becomes an int type. I expect it to be a string type with a value of "RGBYP".

Why is C# designed like this? Wasn't the default implementation of adding two chars should be resulting to a string that concatenates the chars, not int?

Thanks in advance. 


Updated on 06-Jun-2013

Can you answer this question?


Answer

1 Answers

Liked By