Freigeben über


CodeThisReferenceExpression-Klasse

Stellt einen Verweis auf die aktuelle lokale Instanz der Klasse dar.

Namespace: System.CodeDom
Assembly: System (in system.dll)

Syntax

'Declaration
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class CodeThisReferenceExpression
    Inherits CodeExpression
'Usage
Dim instance As CodeThisReferenceExpression
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
public class CodeThisReferenceExpression : CodeExpression
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
public ref class CodeThisReferenceExpression : public CodeExpression
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
public class CodeThisReferenceExpression extends CodeExpression
SerializableAttribute 
ComVisibleAttribute(true) 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
public class CodeThisReferenceExpression extends CodeExpression

Hinweise

Hiermit kann das Klassenobjekt dargestellt werden, auf das mit "this" oder "me" verwiesen wird.

Beispiel

Mit dem folgenden Beispielcode wird veranschaulicht, wie mit einer CodeThisReferenceExpression auf das aktuelle Objekt verwiesen wird.

' 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
// 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.
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 VJ# code generator produces the following source code for the 
// preceeding example code:
// this.TestMethod();

Vererbungshierarchie

System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeExpression
      System.CodeDom.CodeThisReferenceExpression

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

CodeThisReferenceExpression-Member
System.CodeDom-Namespace