I need to perform the following operations with a text file and a List:
- Read all lines of text file (non delimited) into a string based list
- Whilst the application is open I need to do the following:
- Check for instances of a string in the List
- Add new entries to the List
- Remove all identical instances of a defined string from the List
- Write the contents of the List back to the text file including any changes made as soon as they are made
Firstly, how do I read and write between Lists and text files?
Secondly, how do I search a List for a string?
Lastly, how do I safely remove an item out of a List without leaving gaps in the text file I write?
I’d start here:
Read from text file: http://dotnetperls.com/readline
List Actions
1. Removing from a list
2. Searching in a List
Write to a text file: http://www.csharp-station.com/HowTo/ReadWriteTextFile.aspx