Uredi

CodeVariableReferenceExpression Class

Definition

Represents a reference to a local variable.

public ref class CodeVariableReferenceExpression : System::CodeDom::CodeExpression
public class CodeVariableReferenceExpression : System.CodeDom.CodeExpression
type CodeVariableReferenceExpression = class
    inherit CodeExpression
Public Class CodeVariableReferenceExpression
Inherits CodeExpression
Inheritance
CodeVariableReferenceExpression

Examples

The following example code demonstrates use of a CodeVariableReferenceExpression to refer to a local variable.

CodeVariableReferenceExpression variableRef1 =
    new CodeVariableReferenceExpression("TestVariable");

// A C# code generator produces the following source code for the preceeding example code:

//    TestVariable
Dim variableRef1 As New CodeVariableReferenceExpression("TestVariable")
' A Visual Basic code generator produces the following source code for the preceeding example code:

'	TestVariable

Remarks

CodeVariableReferenceExpression can be used to represent a reference to a local variable.

The VariableName property specifies the name of the local variable to reference.

Use CodeFieldReferenceExpression to reference a field. Use CodePropertyReferenceExpression to reference a property. Use CodeEventReferenceExpression to reference an event.

Constructors

Name Description
CodeVariableReferenceExpression()

Initializes a new instance of the CodeVariableReferenceExpression class.

CodeVariableReferenceExpression(String)

Initializes a new instance of the CodeVariableReferenceExpression class using the specified local variable name.

Properties

Name Description
UserData

Gets the user-definable data for the current object.

(Inherited from CodeObject)
VariableName

Gets or sets the name of the local variable to reference.

Applies to