XDeclaration.Version 属性

定义

获取或设置本文档的版本属性。

public:
 property System::String ^ Version { System::String ^ get(); void set(System::String ^ value); };
public string Version { get; set; }
public string? Version { get; set; }
member this.Version : string with get, set
Public Property Version As String

属性值

String包含本文档的版本属性。

示例

以下示例使用此属性打印声明的版本属性。

XDeclaration xd = new XDeclaration("1.0", "utf-8", "yes");
Console.WriteLine(xd.Version);
Console.WriteLine(xd.Encoding);
Console.WriteLine(xd.Standalone);
Dim xd As XDeclaration = New XDeclaration("1.0", "utf-8", "yes")
Console.WriteLine(xd.Version)
Console.WriteLine(xd.Encoding)
Console.WriteLine(xd.Standalone)

此示例生成以下输出:

1.0
utf-8
yes

注解

该值通常是“1.0”。 不强制使用此值。

适用于

另请参阅