How can I store the contents of a char array into a text file in C# with .NET? I have tried
char[] characters = VarInput.ToCharArray();
System.IO.File.WriteAllText(@"C:\Users\leoga\Documents\Projects_Atom\Pad_Wood\WriteText2CharacterArray.txt", characters);
but it comes up with an error message saying
Argument 2: cannot convert from 'char[]' to 'string'
[C:\Users\leoga\Documents\Projects_Atom\Pad_Wood\converter.csproj]
I have also tried it with File.WriteAllLines() but it still doesn't work. I am using c# and .NET
VarInput?WriteAllText(path, VarInput);VarInput.ToCharArray()just for sample purposes and your code is really passed/provided achar[]with no way to associate it with the originalstring(or there was nostringto begin with)? Or you do have astringand were thinking it can only be written to a file as individualchars?