C# Read and Write to a Text File


Console app example of reading and writing to a file. Part of the C# intermediate programming course. Full playlist is here


Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe


  1. I have a question. After I read the textfile, if I wanted to write the same thing in a different format, how could I do that?

    For example, now my textfile says

    11/2/2012 18:22

    N9 45.483 E10 30.495

    416 m

    Now I want to write them to another file in the following manner
    116, 11/2/2012 18:22, N9 45.483 E10 30.495, 416m

    How could I make it so that all the information are lined up in one line, and separate them with " , " ?

  2. I have a question, at the ending you're adding jon doe to the list and then writing the list to the file. But the other names were already in there. I thought there have to be the names from before plus the names from before again plus jon doe. Why is this not the case? Does the content of the file getting overwritten with File.WriteAllLines?


Please enter your comment!
Please enter your name here