XComment::Value Property

 

Gets or sets the string value of this comment.

Namespace:   System.Xml.Linq
Assembly:  System.Xml.Linq (in System.Xml.Linq.dll)

public:
property String^ Value {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

A String that contains the string value of this comment.

Exception Condition
ArgumentNullException

The value is null.

Unlike XElement and XAttribute, you cannot retrieve the contents of a comment by casting it to a string. Instead, you must use this property to retrieve the contents.

Setting this property will raise the Changed and the Changing events.

The following example creates a comment node. It then retrieves the contents of the comment node.

No code example is currently available or this language may not be supported.

This example produces the following output:

This is a comment

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: