CodeMethodInvokeExpression-Klasse
Stellt einen Ausdruck dar, der eine Methode aufruft.
Namespace: System.CodeDom
Assembly: System (in system.dll)
Syntax
'Declaration
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class CodeMethodInvokeExpression
Inherits CodeExpression
'Usage
Dim instance As CodeMethodInvokeExpression
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
public class CodeMethodInvokeExpression : CodeExpression
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
public ref class CodeMethodInvokeExpression : public CodeExpression
/** @attribute SerializableAttribute() */
/** @attribute ComVisibleAttribute(true) */
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */
public class CodeMethodInvokeExpression extends CodeExpression
SerializableAttribute
ComVisibleAttribute(true)
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)
public class CodeMethodInvokeExpression extends CodeExpression
Hinweise
Mit CodeMethodInvokeExpression kann ein Ausdruck dargestellt werden, der eine Methode aufruft.
Die Method-Eigenschaft gibt die aufzurufende Methode an. Die Parameters-Eigenschaft gibt die an die Methode zu übergebenden Parameter an. Mit einer CodeDirectionExpression wird die Feldrichtung eines Parameters angegeben.
Beispiel
In diesem Beispiel wird veranschaulicht, wie mit einer CodeMethodInvokeExpression eine Methode aufgerufen wird.
' This CodeMethodInvokeExpression calls Me.Dispose(true)
' The targetObject parameter indicates the object containing the method to invoke.
' The methodName parameter indicates the method to invoke.
' The parameters array contains the parameters for the method invoke.
Dim methodInvoke As New CodeMethodInvokeExpression( _
New CodeThisReferenceExpression(), _
"Dispose", _
New CodeExpression() {New CodePrimitiveExpression(True)})
' A Visual Basic code generator produces the following source code for the preceeding example code:
' Me.Dispose(true)
CodeMethodInvokeExpression methodInvoke = new CodeMethodInvokeExpression(
// targetObject that contains the method to invoke.
new CodeThisReferenceExpression(),
// methodName indicates the method to invoke.
"Dispose",
// parameters array contains the parameters for the method.
new CodeExpression[] { new CodePrimitiveExpression(true) } );
// A C# code generator produces the following source code for the preceeding example code:
// this.Dispose(true);
array<CodeExpression^>^temp0 = {gcnew CodePrimitiveExpression( true )};
// parameters array contains the parameters for the method.
CodeMethodInvokeExpression^ methodInvoke = gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"Dispose",temp0 );
// A C# code generator produces the following source code for the preceeding example code:
// this.Dispose(true);
CodeMethodInvokeExpression methodInvoke = new CodeMethodInvokeExpression(
// targetObject that contains the method to invoke.
new CodeThisReferenceExpression(),
// methodName indicates the method to invoke.
"Dispose",
// parameters array contains the parameters for the method.
new CodeExpression[] { new CodePrimitiveExpression(
System.Convert.ToString(true)) });
// A VJ# code generator produces the following source code for the
// preceeding example code:
// this.Dispose(true);
Vererbungshierarchie
System.Object
System.CodeDom.CodeObject
System.CodeDom.CodeExpression
System.CodeDom.CodeMethodInvokeExpression
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
CodeMethodInvokeExpression-Member
System.CodeDom-Namespace
CodeDirectionExpression-Klasse