14

How do I combine two char's into a single string?

It seems as I cannot for the life of me find out how to do it whatsoever.

2
  • 2
    How about this method? 'A'.ToString() + 'B'.ToString() Simply use ToString method and then add the strings. Commented Jul 2, 2017 at 9:50
  • 3
    While jitendragarg's method works, it creates more garbage than is necessary. Two garbage strings for a single resulting string. Fruchtzwerg's method creates a single garbage object for the resulting string. Commented Feb 20, 2020 at 2:48

1 Answer 1

26
char[] chars = {'a', 'b'}; string s = new string(chars); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.