CodeThisReferenceExpression 类

定义

表示对当前本地类实例的引用。

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

示例

以下示例代码演示如何使用 CodeThisReferenceExpression 引用当前对象。

// 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”引用的类对象。

构造函数

CodeThisReferenceExpression()

初始化 CodeThisReferenceExpression 类的新实例。

属性

UserData

获取当前对象的用户可定义数据。

(继承自 CodeObject)

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于