Reputation: 2613
I'm trying the following code:
string text = "";
char c = 'd';
text += "abc" & c.ToString();
..but it returns an error 'Operator '&' cannot...' . It don't works even without ToString(). What's the problem converting char to string?
Upvotes: 1
Views: 12835
Reputation: 28596
The string concatenation operator is a plus sign in C#, not an ampersand.
Upvotes: 2
Reputation: 69983
You don't use &
for string concatentation in C#, you use +
string text = "";
char c = 'd';
text += "abc" + c;
Upvotes: 12