StreamWriter.Null 字段  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供 StreamWriter,它不带任何可写入但无法从中读取的后备存储。
public: static initonly System::IO::StreamWriter ^ Null;public static readonly System.IO.StreamWriter Null; staticval mutable Null : System.IO.StreamWriterPublic 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))
{
    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 任务。