XComment.Value 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定這個註解的字串值。
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。
例外狀況
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 事件。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應