Writing Files
メニューを表示するにはスワイプしてください
Recap
- We can use the
StreamWriterobject for writing files; - If the file at the specified path does not exist, the
StreamWriterobject creates it; - If the file at the specified object already exists, the
StreamWriterobject by default overwrites it - which means that the previous content will be deleted. We will learn how to prevent that in the upcoming section; StreamWriterhas aWriteLinemethod for writing a line of text into a file. This method automatically moves the cursor to the next line after writing is done. In other words, it automatically appends a "\n" character after the text we write into the file;- Similar to
WriteLine, there is aWritemethod, however, it doesn't move the cursor to the next line after writing text into a file; - Just like
StreamReader, we also need to close theStreamWriterobject either by using theClose()method or by utilizing theusingstatement to automatically close it after use.
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 8
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください
セクション 1. 章 8