CodeVariable2::InitExpression Property
Gets or sets an object defining the initialization code for an element.
Assembly: EnvDTE80 (in EnvDTE80.dll)
Property Value
Type: System::Object^An object defining the initialization expression for the code variable.
Implements
CodeVariable::InitExpressionThe value must be a string or a CodeElement for an expression object. When setting this to a string, the implementation of InitExpression inserts any syntax required, such as equal signs or semicolons if the variable does not already have an initialization expression.
Depending on the languages and any syntactic or semantic checks it performs on the string passed in, setting InitExpression might fail. Languages are not required to check the string, and because the string is necessarily language-dependent, setting this property can result in undefined behavior if the string has ill-formed content in any way.
When setting this property to a CodeElement, whether or not the CodeElement must be newly created depends on the language implementation of the code model. Some languages might implement copying semantics if you pass in a CodeElement that is already in a source file.
Note |
|---|
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). |
