Export (0) Print
Expand All

XDeclaration Constructor (String, String, String)

Initializes a new instance of the XDeclaration class with the specified version, encoding, and standalone status.

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

public XDeclaration(
	string version,
	string encoding,
	string standalone
)

Parameters

version
Type: System.String
The version of the XML, usually "1.0".
encoding
Type: System.String
The encoding for the XML document.
standalone
Type: System.String
A string containing "yes" or "no" that specifies whether the XML is standalone or requires external entities to be resolved.

The following example creates a document that contains a declaration.


XDocument doc = new XDocument(
    new XDeclaration("1.0", "utf-8", "yes"),
    new XComment("This is a comment"),
    new XElement("Root", "content")
);


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft