CodeAttribute2::Value Property

 

Sets or gets the data for the code attribute.

Namespace:   EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

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

Property Value

Type: System::String^

A string value representing the data for the code attribute.

If an attribute is in the form name(someval, 2), then the value is someval, 2.

System_CAPS_noteNote

Code attribute argument values, after being assigned, are not retained in memory by Visual Studio, and thus, may or may not be valid when a future update to the code attribute argument occurs. That is, a subsequent argument access may return E_FAIL or a totally different value. (Anything that affects the element's children, however, does not have this problem.)

Because of this non-deterministic behavior, you should retrieve the argument's value prior to changing it. For example, if you set a code attribute argument in your code, such as myAttrArg.Value = """a first value""", then you should explicitly reference it before updating it, such as myAttrArg = myAttr.Arguments.Item("first value"), and then assign the new value, myAttrArg.Value = """a second value""". Doing this ensures that the correct argument is changed.

Also, the values of code model elements such as classes, structs, functions, attributes, delegates, and so forth can be non-deterministic after making certain kinds of edits, meaning that their values cannot be relied upon to always remain the same. For more information, see the section Code Model Element Values Can Change in Discovering Code by Using the Code Model (Visual Basic).

The following example creates a new namespace and attribute in the current class and lists some of the attribute's properties.

No code example is currently available or this language may not be supported.
Return to top
Show: