Saving from List to txt

后端 未结 7 1813
生来不讨喜
生来不讨喜 2020-12-03 13:26

I want my program to read from two text files into one List. The List is sorting and cleaning duplicates.

I want the

7条回答
  •  隐瞒了意图╮
    2020-12-03 13:53

    It's this line which writes the ToString representation of the List, resulting into the text line you got:

    StreamWriter file = new System.IO.StreamWriter(speichern);
    file.WriteLine(ausgabeListe);
    file.Close();
    

    Instead you want to write each line.

    StreamWriter file = new System.IO.StreamWriter(speichern);
    ausgabeListe.ForEach(file.WriteLine);
    file.Close();
    

提交回复
热议问题