CodeVariableReferenceExpression 类

定义

表示局部变量的引用。Represents a reference to a local variable.

public ref class CodeVariableReferenceExpression : System::CodeDom::CodeExpression
[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
继承
CodeVariableReferenceExpression
属性

示例

下面的示例代码演示CodeVariableReferenceExpression如何使用引用局部变量。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

注解

CodeVariableReferenceExpression可用于表示对本地变量的引用。CodeVariableReferenceExpression can be used to represent a reference to a local variable.

VariableName属性指定要引用的局部变量的名称。The VariableName property specifies the name of the local variable to reference.

用于CodeFieldReferenceExpression引用字段。Use CodeFieldReferenceExpression to reference a field. 用于CodePropertyReferenceExpression引用属性。Use CodePropertyReferenceExpression to reference a property. 用于CodeEventReferenceExpression引用事件。Use CodeEventReferenceExpression to reference an event.

构造函数

CodeVariableReferenceExpression()

初始化 CodeVariableReferenceExpression 类的新实例。Initializes a new instance of the CodeVariableReferenceExpression class.

CodeVariableReferenceExpression(String)

使用指定的局部变量名称初始化 CodeVariableReferenceExpression 类的新实例。Initializes a new instance of the CodeVariableReferenceExpression class using the specified local variable name.

属性

UserData

获取当前对象的用户可定义数据。Gets the user-definable data for the current object.

(继承自 CodeObject)
VariableName

获取或设置要引用的局部变量的名称。Gets or sets the name of the local variable to reference.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于