StreamWriter.Null 欄位

定義

提供 StreamWriter,但不包含可寫入但無法讀取的備份存放區。Provides a StreamWriter with no backing store that can be written to, but not read from.

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 

欄位值

StreamWriter

範例

下列範例示範如何使用 Null 欄位。The following example demonstrates a use of the Null field.

if ( sw->Equals( StreamWriter::Null ) )
{
   sw->WriteLine( "The store can be written to, but not read from." );
}
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 不會使用任何作業系統資源的。Use Null to redirect output to a StreamWriter that will not consume any operating system resources.

StreamWriter.Write 上叫用方法時 Null ,呼叫只會傳回,而且不會實際將任何資料寫入任何備份存放區。When the StreamWriter.Write methods are invoked on Null, the call simply returns, and no data is actually written to any backing store.

如需一般 i/o 工作的清單,請參閱 一般 i/o工作。For a list of common I/O tasks, see Common I/O Tasks.

適用於