CloseOutput Property

XmlWriterSettings.CloseOutput Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets a value indicating whether the XmlWriter should also close the underlying stream or TextWriter when the Close method is called.

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

'Declaration
Public Property CloseOutput As Boolean

Property Value

Type: System.Boolean
true to also close the underlying stream or TextWriter; otherwise false. The default is false.

This setting is useful when you wish to write XML to a stream, and then add extra information to the end of the stream after the XmlWriter has finished writing.

This property only applies to XmlWriter instances that output XML content to a stream or TextWriter; otherwise, this setting is ignored.


            Dim settings As New XmlWriterSettings()
            settings.OmitXmlDeclaration = True
            settings.ConformanceLevel = ConformanceLevel.Fragment
            settings.CloseOutput = False

            ' Create the XmlWriter object and write some content.
            Dim strm As New MemoryStream()
            Using writer As XmlWriter = XmlWriter.Create(strm, settings)
                writer.WriteElementString("orderID", "1-456-ab")
                writer.WriteElementString("orderID", "2-36-00a")
                writer.Flush()
            End Using



Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft