WriteValue Method (Boolean)

XmlWriter.WriteValue Method (Boolean)


Writes a Boolean value.

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

public virtual void WriteValue(
	bool value


Type: System.Boolean

The Boolean value to write.

Exception Condition

An invalid value was specified.


An XmlWriter method was called before a previous asynchronous operation finished. In this case, InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

This method takes the common language runtime object and converts the input value to the desired output type using the XML Schema definition language (XSD) data type conversion rules.

When the WriteValue method is called, the XmlWriter converts the value to its string representations according to the XML Schema (XSD) data type rules and writes it out using the WriteString method.

If WriteValue is called multiple times in succession, the values are not delimited by a space. You must call WriteWhitespace between calls to WriteValue to insert white space. Pass an array type to the XmlWriter.WriteValue(Object) overload to write out an array of distinct values.

If this method is called on an XmlWriter instance that outputs text-only, the typed value is serialized to text.

For asynchronous operations, convert the return value of this method to a string and use the WriteStringAsync method.

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft