語言

XComment.Value 屬性

定義

取得或設定此留言的字串值。

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

屬性值

String A 包含這則註解的字串值。

例外狀況

value 是 null。

範例

以下範例建立一個註解節點。 接著它會擷取註解節點的內容。

XComment com = new XComment("This is a comment");
Console.WriteLine(com.Value);
Dim com As XComment = New XComment("This is a comment")
Console.WriteLine(com.Value)

此範例會產生下列輸出:

This is a comment

備註

與 和 XElement不同XAttribute,你無法透過將註解投射成字串來取得其內容。 相反地,你必須利用這個屬性來取得內容。

設定此屬性會提升事件Changed。Changing

適用於

另請參閱