JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the StreamWriter Class

After you've opened a file for writing using the FileStream class (see "Using the FileStream Class" in this chapter), you can create a StreamWriter object to write text to the file. Here is the hierarchy of the StreamWriter class:

Object
   MarshalByRefObject
      TextWriter
         StreamWriter

You can find the more notable public properties of the StreamWriter class in Table 13.12, and the more notable methods in Table 13.13.

Table 13.12: Noteworthy public properties of StreamWriter objects.

Property

Means

AutoFlush

Gets/sets if the StreamWriter will flush its buffer after Write or WriteLine operation.

BaseStream

Gets the base stream for this stream, giving you access to the base stream's properties and methods.

Encoding

Gets the character encoding for this stream.

Table 13.13: Noteworthy public methods of StreamWriter objects.

Method

Means

Close

Closes the current stream.

Flush

Flushes all buffers for the stream writer, writing any buffered data to the base stream.

Write

Writes data to the stream.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor