C# StreamWriter Null

Description

StreamWriter Null Provides a StreamWriter with no backing store that can be written to, but not read from.

Syntax

StreamWriter.Null has the following syntax.


public static readonly StreamWriter Null

Example

The following example demonstrates a use of the Null field.


using System.IO;//  w  ww .  j  a va  2s  .c  o  m
using System;
public class MainClass{
  public static void Main(String[] argv){  
    StreamWriter sw = new StreamWriter("abc.txt");
    
    if(sw.Equals(StreamWriter.Null)) 
    {
        sw.WriteLine("The store can be written to, but not read from.");
    }

  }
}
    




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter