How to convert List <char> to List <string> in C #?
I have a text. e.g. string text = "COMPUTER"
And I want to break it into characters so that each character is like a string.
If there was any delimiter I could use text.Split(delimiter) .
But there is no separator, I convert it to a char array using text.ToCharArray().toList() .
And after that I get a List<char> . But I need a List<string> .
So how can I convert a List<char> to a List<string> .
+5
6 answers
string bla = "COMPUTER"; //Your String List<char> list = bla.ToCharArray().ToList(); //Your char list List<string> otherList = new List<string>(); //Your string list list.ForEach(c => otherList.Add(c.ToString())); //iterate through char-list convert every char to string and add it to your string list +1