System.Xml.XmlWriter.WriteCData Method

When overridden in a derived class, writes out a <![CDATA[...]]> block containing the specified text.

Syntax

public abstract void WriteCData (string text)

Parameters

text
The text to place inside the CDATA block.

Exceptions

TypeReason
ArgumentExceptionThe text would result in a non-well formed XML document.
InvalidOperationExceptionThe XmlWriter.WriteState is WriteState.Closed.

Remarks

If text is either null or String.Empty, this method writes an empty CDATA block, for example <![CDATA[]]>.

For the asynchronous version of this method, see XmlWriter.WriteCDataAsync(string).

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0