StreamWriter.Null StreamWriter.Null StreamWriter.Null StreamWriter.Null Field

定義

提供 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." );
}
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.

在上Null叫用方法時,呼叫只會傳回,而且不會實際將資料寫入任何備份存放區。StreamWriter.WriteWhen 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.

適用於

另請參閱