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

例外

valuenull です。

次の例では、コメント ノードを作成します。 次に、コメント ノードの内容を取得します。

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  

注釈

XAttributeとは異なりXElement、コメントを文字列にキャストすることで、コメントの内容を取得することはできません。 代わりに、このプロパティを使用してコンテンツを取得する必要があります。

このプロパティを設定すると、 Changed イベントと イベントが発生します Changing

適用対象

こちらもご覧ください