Bewerken

CodeThisReferenceExpression Class

Definition

Represents a reference to the current local class instance.

public ref class CodeThisReferenceExpression : System::CodeDom::CodeExpression
public class CodeThisReferenceExpression : System.CodeDom.CodeExpression
type CodeThisReferenceExpression = class
    inherit CodeExpression
Public Class CodeThisReferenceExpression
Inherits CodeExpression
Inheritance
CodeThisReferenceExpression

Examples

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 = 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

Remarks

This can represent the class object that is referenced by "this" or "me".

Constructors

Name Description
CodeThisReferenceExpression()

Initializes a new instance of the CodeThisReferenceExpression class.

Properties

Name Description
UserData

Gets the user-definable data for the current object.

(Inherited from CodeObject)

Applies to