StreamWriter.Null 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供 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 任務的清單,請參見 Common I/O 任務。