StreamWriter.Null フィールド

定義

書き込み可能で読み取りはできないバッキング ストアのない StreamWriter を提供します。

public: static initonly System::IO::StreamWriter ^ Null;
public static readonly System.IO.StreamWriter Null;
 staticval mutable Null : System.IO.StreamWriter
Public Shared ReadOnly Null As StreamWriter 

フィールド値

次の例では、 Null フィールドの使用方法を示します。

if(sw.Equals(StreamWriter.Null))
{
    sw.WriteLine("The store can be written to, but not read from.");
}
If Sw.Equals(StreamWriter.Null) Then
    Sw.WriteLine("The store can be written to, but not read from.")
End If

注釈

Nullを使用して、オペレーティング システム リソースを消費しないStreamWriterに出力をリダイレクトします。

StreamWriter.WriteメソッドがNullで呼び出されると、呼び出しは単に戻り、実際にはバッキング ストアにデータは書き込まれなくなります。

一般的な I/O タスクの一覧については、「 一般的な I/O タスク」を参照してください。

適用対象

こちらもご覧ください