ファイルを管理します。
new System.IO.StreamWriter(string path)
new System.IO.StreamWriter(string path, bool append)
System.IO.StreamWriter.WriteLine(string text)
System.IO.StreamWriter.WriteAsync(string text)
System.IO.Stream.Close()
System.IO.File.ReadAllText(string path)
System.IO.File.ReadAllLines(string path)
System.IO.File.ReadLines(string path)
System.IO.File.WriteAllText(string path, string text)
System.IO.File.WriteAllLines(string path, IEnumerable<string> contents)
System.IO.File.Copy(string source, string dest)
System.IO.File.Create(string path)
System.IO.File.Delete(string path)
System.IO.File.Move(string source, string dest)
System.IO.Directory.GetFiles(string path)
パラメータ | 詳細 |
---|---|
パス | ファイルの場所。 |
追加する | ファイルが存在する場合、trueはファイルの末尾にデータを追加し(追加)、falseはファイルを上書きします。 |
テキスト | 書き込まれるか格納されるテキスト。 |
内容 | 書き込まれる文字列のコレクション。 |
ソース | 使用するファイルの場所。 |
dest | ファイルを移動する場所。 |
Stream
オブジェクトを閉じてください。上記のようにusing
ブロックをusing
か、 myStream.Close()
手動で呼び出してこれを行うことができます。 @"C:\MyFolder\MyFile.txt"
ようにバックスラッシュを含むパス文字列を宣言するときは、 逐語文字列を使用する必要があります@"C:\MyFolder\MyFile.txt"