NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

StreamWriter Constructor (String, Boolean, Encoding, Int32)

Creates a new instance of the StreamWriter class for the specified file on the specified path, using the specified encoding and buffer size. Overwrites or appends to an existing file, or creates a new file.

[Visual Basic]
Overloads Public Sub New( _
   ByVal path As String, _
   ByVal append As Boolean, _
   ByVal encoding As Encoding, _
   ByVal bufferSize As Integer _
)
[C#]
public StreamWriter(
   string path,
   bool append,
   Encoding encoding,
   int bufferSize
);
[C++]
public: StreamWriter(
   String* path,
   bool append,
   Encoding* encoding,
   int bufferSize
);
[JScript]
public function StreamWriter(
   path : String,
   append : Boolean,
   encoding : Encoding,
   bufferSize : int
);

Parameters

path
The complete file path to write to.
append
Determines whether data is to be appended to the file. If the file exists and append is false, the file is overwritten. If the file exists and append is true, the data is appended to the file. Otherwise, a new file is created.
encoding
Determines which character encoding to use.
bufferSize
Sets the buffer size.

Exceptions

Exception Type Condition
ArgumentException path is an empty string ("").
ArgumentNullException path or encoding is null.
ArgumentOutOfRangeException bufferSize is negative.
FileNotFoundException The file cannot be found.
IOException path includes an incorrect or invalid syntax for file name, directory name, or volume label syntax.
SecurityException The caller does not have the required permission.

See Also

StreamWriter Class | StreamWriter Members | System.IO Namespace | StreamWriter Constructor Overload List