Because the StreamWriter object is declared and instantiated in a using statement, the Dispose method is invoked, which automatically flushes and closes the stream. The following example shows how to use the StreamWriter class to synchronously write text to a new file one line at a time. Example: Synchronously write text with StreamWriter A real-world app usually provides more robust error checking and exception handling. The following examples show only the minimum amount of code needed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |