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

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」。 不會強制執行此值。

適用於

另請參閱