Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
This code works fine on wpf.
In my code list1 will work but if convert a string to a list of char and change again to string it showing error of : can't convert from char[] to string [].
need suggestion.
here's the code :
string x = "hello";
List<char> list = x.ToList<char>();
//error
string combindedString = string.Join(",", list.ToArray());
string xz = string.Join("", list);
//---
//okay....
List<string> list1 = new List<string>()
"Red",
"Blue",
"Green"
string output = string.Join("", list1.ToArray());
–
Well I suspect the source of your issue still lies with using the older .Net Framework that is default with Unity, 3.5 I believe. You have some options, to work around the problem though:
You can target an update framework, I believe Unity supports up to 4.6.1 in experimental mode.
You can work around converting a char[]
to string.
Or just use the string constructor:
A simple example:
[Test]
public void StringTest()
string x = "hello";
List<char> list = x.ToList<char>();
string newStr = new string(list.ToArray());
Assert.IsTrue(newStr == x);
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.