There is a code that saves the text in txt line by line ...

private static void Save(string data) { StreamWriter writer = new StreamWriter("data.txt", true, Encoding.GetEncoding("windows-1251")); writer.Write(data + Environment.NewLine); writer.Close(); } 

but I need it to be saved through a single line space
instead

one
2
3

=> should be like this: 1 2 3

  • 3
    replace Environment.NewLine with a space - Grundy
  • @Grundy ok ,,,,, - user240095

1 answer 1

It probably should be like this:

 private static void Save(string data) { StreamWriter writer = new StreamWriter("data.txt", true, Encoding.GetEncoding("windows-1251")); writer.Write(data + " "); writer.Close(); } 

Environment.NewLine replaced by a space.