CodeVariableReferenceExpression CodeVariableReferenceExpression CodeVariableReferenceExpression CodeVariableReferenceExpression Class

Definition

Represents a reference to a local variable.

public ref class CodeVariableReferenceExpression : System::CodeDom::CodeExpression
[System.Runtime.InteropServices.ClassInterface]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeVariableReferenceExpression : System.CodeDom.CodeExpression
type CodeVariableReferenceExpression = class
    inherit CodeExpression
Public Class CodeVariableReferenceExpression
Inherits CodeExpression
Inheritance
CodeVariableReferenceExpressionCodeVariableReferenceExpressionCodeVariableReferenceExpressionCodeVariableReferenceExpression
Attributes

Examples

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

CodeVariableReferenceExpression^ variableRef1 = gcnew CodeVariableReferenceExpression( "TestVariable" );

// A C# code generator produces the following source code for the preceeding example code:
//    TestVariable
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

CodeVariableReferenceExpression() CodeVariableReferenceExpression() CodeVariableReferenceExpression() CodeVariableReferenceExpression()

Initializes a new instance of the CodeVariableReferenceExpression class.

CodeVariableReferenceExpression(String) CodeVariableReferenceExpression(String) CodeVariableReferenceExpression(String) CodeVariableReferenceExpression(String)

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

Properties

UserData UserData UserData UserData

Gets the user-definable data for the current object.

(Inherited from CodeObject)
VariableName VariableName VariableName VariableName

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

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to