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 




下列範例示範如何使用 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." );
    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.