Partager via


JsonReaderWriterFactory.CreateJsonWriter Method (Stream, Encoding, Boolean)

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 and that specifies whether the output stream is closed by the writer when it is done.

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, _
    ownsStream As Boolean _
) As XmlDictionaryWriter
public static XmlDictionaryWriter CreateJsonWriter(
    Stream stream,
    Encoding encoding,
    bool ownsStream
)

Parameters

  • ownsStream
    Type: System.Boolean
    If true, the output stream is closed by the writer when done; otherwise, false. The default value is true.

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).

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.