XmlTextWriter Constructor (Stream, Encoding)

 

Creates an instance of the XmlTextWriter class using the specified stream and encoding.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public XmlTextWriter(
	Stream w,
	Encoding encoding
)

Parameters

w
Type: System.IO.Stream

The stream to which you want to write.

encoding
Type: System.Text.Encoding

The encoding to generate. If encoding is null it writes out the stream as UTF-8 and omits the encoding attribute from the ProcessingInstruction.

Exception Condition
ArgumentException

The encoding is not supported or the stream cannot be written to.

ArgumentNullException

w is null.

System_CAPS_noteNote

Starting with the .NET Framework 2.0, we recommend that you create XmlWriter instances by using the XmlWriter.Create method and the XmlWriterSettings class to take advantage of new functionality.

.NET Framework
Available since 1.1
Return to top
Show: