Editar

Compartir a través de


CodeVariableReferenceExpression Class

Definition

Represents a reference to a local variable.

public ref class CodeVariableReferenceExpression : System::CodeDom::CodeExpression
public class CodeVariableReferenceExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeVariableReferenceExpression : System.CodeDom.CodeExpression
type CodeVariableReferenceExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeVariableReferenceExpression = class
    inherit CodeExpression
Public Class CodeVariableReferenceExpression
Inherits CodeExpression
Inheritance
CodeVariableReferenceExpression
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()

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

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.

Methods

Equals(Object)

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

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to