CodeVariableReferenceExpression 類別

定義

表示區域變數的參考。

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
繼承
CodeVariableReferenceExpression
屬性

範例

下列範例程式代碼示範如何使用 CodeVariableReferenceExpression 來參考局部變數。

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 可用來表示局部變數的參考。

屬性 VariableName 會指定要參考之局部變數的名稱。

使用 CodeFieldReferenceExpression 來參考欄位。 使用 CodePropertyReferenceExpression 來參考 屬性。 使用 CodeEventReferenceExpression 來參考事件。

建構函式

CodeVariableReferenceExpression()

初始化 CodeVariableReferenceExpression 類別的新執行個體。

CodeVariableReferenceExpression(String)

使用指定的區域變數名稱,初始化 CodeVariableReferenceExpression 類別的新執行個體。

屬性

UserData

取得目前物件的使用者可定義資料。

(繼承來源 CodeObject)
VariableName

取得或設定要參考的區域變數名稱。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於