I pass a string containing separate characters on each line to a Unicode list with this code.
string MultiLineCharArray = string.Join(Environment.NewLine, CharArray);
var UnicodeList = MultiLineCharArray.Select(str => Convert.ToUInt16(str)).ToList();
when reversing it the program dies, it does not even try, very badly:
for (int i = 0; i < UnicodeList.Count; i++)
{
MultiLineCharArray = string.Join(Environment.NewLine, Convert.ToChar(UnicodeList[i]));
}
I need the MultiLineCharArray
to then convert it into an Array
of its valid Unicode characters (unicode = A)
going through each line to convert it to a single string.
The Unicode list is very long (9,000) elements, maybe that's why the program crashed, is there a more optimal way to do it?