CodeMethodInvokeExpression Osztály

Definíció

Metódust meghívó kifejezést jelöl.

public ref class CodeMethodInvokeExpression : System::CodeDom::CodeExpression
public class CodeMethodInvokeExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeMethodInvokeExpression : System.CodeDom.CodeExpression
type CodeMethodInvokeExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeMethodInvokeExpression = class
    inherit CodeExpression
Public Class CodeMethodInvokeExpression
Inherits CodeExpression
Öröklődés
CodeMethodInvokeExpression
Attribútumok

Példák

Ez a példa bemutatja, hogy egy metódus meghívásához használ-e CodeMethodInvokeExpression egy metódust.

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);
' 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)

Megjegyzések

CodeMethodInvokeExpression metódust meghívó kifejezés ábrázolására használható.

A Method tulajdonság megadja a meghívandó metódust. A Parameters tulajdonság a metódusnak átadni kívánt paramétereket jelzi. CodeDirectionExpression Egy paraméter mezőirányának megadására használható.

Konstruktorok

Name Description
CodeMethodInvokeExpression()

Inicializálja a CodeMethodInvokeExpression osztály új példányát.

CodeMethodInvokeExpression(CodeExpression, String, CodeExpression[])

Inicializálja az CodeMethodInvokeExpression osztály új példányát a megadott célobjektum, metódusnév és paraméterek használatával.

CodeMethodInvokeExpression(CodeMethodReferenceExpression, CodeExpression[])

Inicializálja az CodeMethodInvokeExpression osztály új példányát a megadott módszerrel és paraméterekkel.

Tulajdonságok

Name Description
Method

Lekéri vagy beállítja a meghívandó metódust.

Parameters

Lekéri a metódus meghívásához szükséges paramétereket.

UserData

Lekéri az aktuális objektum felhasználó által definiálható adatait.

(Öröklődés forrása CodeObject)

Metódusok

Name Description
Equals(Object)

Meghatározza, hogy a megadott objektum egyenlő-e az aktuális objektummal.

(Öröklődés forrása Object)
GetHashCode()

Ez az alapértelmezett kivonatoló függvény.

(Öröklődés forrása Object)
GetType()

Lekéri az Type aktuális példányt.

(Öröklődés forrása Object)
MemberwiseClone()

Az aktuális Objectpéldány sekély másolatát hozza létre.

(Öröklődés forrása Object)
ToString()

Az aktuális objektumot jelképező sztringet ad vissza.

(Öröklődés forrása Object)

A következőre érvényes:

Lásd még