how to edit a line from a text file using c#

Hello all!

My records are in a text file format. I need to update a line from that text file using C#, how do I do that I'm new with C# so any suggestion will be greatly appreciated...



Answer this question

how to edit a line from a text file using c#

  • RapidLord

    I read the file but I need to know how to change one line of the file (really just one character). I checked to see if s.Equals("my string") but I can't seem to figure out how to change "my string" to my String". Any help

    Thanks.

    Mike


  • Michael Sims

    System.IO.File.ReadAllLines and System.IO.File.WriteAllLines is your best bet, then you can read the file in, find the line and change it, then write it again. You cannot change a line in a file, you need to read it all, change it and write it all again.



  • how to edit a line from a text file using c#