Share via


VCCodeVariable.InitExpression Property

Definition

Gets or sets an object defining the initialization code for an element.

public:
 property System::Object ^ InitExpression { System::Object ^ get(); void set(System::Object ^ value); };
public:
 property Platform::Object ^ InitExpression { Platform::Object ^ get(); void set(Platform::Object ^ value); };
[System.Runtime.InteropServices.DispId(33)]
public object InitExpression { [System.Runtime.InteropServices.DispId(33)] get; [System.Runtime.InteropServices.DispId(33)] set; }
[<System.Runtime.InteropServices.DispId(33)>]
[<get: System.Runtime.InteropServices.DispId(33)>]
[<set: System.Runtime.InteropServices.DispId(33)>]
member this.InitExpression : obj with get, set
Public Property InitExpression As Object

Property Value

An object defining the initialization expression for the code variable.

Attributes

Remarks

The value must be a string or a CodeElement for an expression object. When setting this to a string, the implementation of the property inserts any required syntax, 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 this property 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.

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.

Applies to