CodeThisReferenceExpression CodeThisReferenceExpression CodeThisReferenceExpression CodeThisReferenceExpression Class

定義

表示目前的區域類別 (Local Class) 執行個體的參考。Represents a reference to the current local class instance.

public ref class CodeThisReferenceExpression : System::CodeDom::CodeExpression
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeThisReferenceExpression : System.CodeDom.CodeExpression
type CodeThisReferenceExpression = class
    inherit CodeExpression
Public Class CodeThisReferenceExpression
Inherits CodeExpression
繼承
CodeThisReferenceExpressionCodeThisReferenceExpressionCodeThisReferenceExpressionCodeThisReferenceExpression
屬性

範例

下列範例程式碼示範如何使用CodeThisReferenceExpression來參考目前的物件。The following example code demonstrates use of a CodeThisReferenceExpression to refer to the current object.

// Invokes the TestMethod method of the current type object.
CodeMethodReferenceExpression^ methodRef1 = gcnew CodeMethodReferenceExpression( gcnew CodeThisReferenceExpression,"TestMethod" );
array<CodeParameterDeclarationExpression^>^temp1;
CodeMethodInvokeExpression^ invoke1 = gcnew CodeMethodInvokeExpression( methodRef1,temp1 );

// A C# code generator produces the following source code for the preceeding example code:
//        this.TestMethod();
// Invokes the TestMethod method of the current type object.
CodeMethodReferenceExpression methodRef1 = new CodeMethodReferenceExpression( new CodeThisReferenceExpression(), "TestMethod" );
CodeMethodInvokeExpression invoke1 = new CodeMethodInvokeExpression( methodRef1, new CodeParameterDeclarationExpression[] {} );                                    

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

//        this.TestMethod();

' Invokes the TestMethod method of the current type object.
Dim methodRef1 As New CodeMethodReferenceExpression(New CodeThisReferenceExpression(), "TestMethod")
Dim invoke1 As New CodeMethodInvokeExpression(methodRef1, New CodeParameterDeclarationExpression() {})

' A Visual Basic code generator produces the following source code for the preceeding example code:

'       Me.TestMethod

備註

這可以代表 "this" 或 "me" 所參考的類別物件。This can represent the class object that is referenced by "this" or "me".

建構函式

CodeThisReferenceExpression() CodeThisReferenceExpression() CodeThisReferenceExpression() CodeThisReferenceExpression()

初始化 CodeThisReferenceExpression 類別的新執行個體。Initializes a new instance of the CodeThisReferenceExpression class.

屬性

UserData UserData UserData UserData

取得目前物件的使用者可定義資料。Gets the user-definable data for the current object.

(Inherited from CodeObject)

方法

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()

取得目前執行個體的 TypeGets the Type of the current instance.

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

建立目前 Object 的淺層複本 (Shallow Copy)。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)

適用於