Obviously, manipulating text files is job one for any Notepad clone. I originally implemented the opening half of that equation using the StreamReader object, but changed to a more efficient method using the File object thanks to a reader suggestion. So I scrapped my original StreamReader-based approach to saving a text file and switched to the File object there as well.
If you think about how Notepad works, the Save and Save As operations come up quite a bit, and in different ways. If you start with a blank document and type CTRL + S (or choose File > Save), you’ll be prompted to provide a filename and path using a system Save As dialog box. But if you’ve previously saved the document, this will just save it again with no prompting. Likewise, you’ll be prompted to save if you have an unsaved document (or a saved document with unsaved changes) and try to close the application. Save As has its own permutations as well. And we have to try and address all of them.