I have code like the following that turns a list of strings into one string of the contents separated by n
List<string> list = new List<string>();
list.Add("string1");
list.Add("string2");
list.Add("string3");
string stringOfListContents = string.Join("n", list);
then when I write the string to a output file like:
using (PowerShell PowerShellInstance = PowerShell.Create())
{
PowerShellInstance.Streams.ClearStreams();
PowerShellInstance.AddCommand("Set-Content");
PowerShellInstance.AddParameter("Path", outputFile);
PowerShellInstance.AddParameter("Value", stringOfListContents);
PowerShellInstance.Invoke();
}
The result is
string1string2string3
but I would like the result in the txt file to be like
string1
string2
string3