JsonReaderWriterFactory.CreateJsonWriter Method (Stream, Encoding)
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream with a specified character encoding.
Namespace: System.Runtime.Serialization.Json
Assembly: System.Runtime.Serialization.Json (in System.Runtime.Serialization.Json.dll)
Syntax
'Declaration
Public Shared Function CreateJsonWriter ( _
stream As Stream, _
encoding As Encoding _
) As XmlDictionaryWriter
public static XmlDictionaryWriter CreateJsonWriter(
Stream stream,
Encoding encoding
)
Parameters
- stream
Type: System.IO.Stream
The output Stream for the JSON writer.
- encoding
Type: System.Text.Encoding
The Encoding that specifies the character encoding used by the writer. The default encoding is UTF-8.
Return Value
Type: System.Xml.XmlDictionaryWriter
An XmlDictionaryWriter that writes data encoded with JSON to the stream from an XML Infoset.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | stream or encoding is nulla null reference (Nothing in Visual Basic). |
Remarks
When the writer is closed, the stream is closed by this overload as well. If you do not want the stream to be closed by the writer when it is done, then use the CreateJsonWriter(Stream, Encoding, Boolean) overload where this behavior can be specified.
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.