CodeMethodInvokeExpression 類別

定義

表示叫用 (Invoke) 方法的運算式。

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
繼承
CodeMethodInvokeExpression
屬性

範例

此範例示範如何使用 來叫用 CodeMethodInvokeExpression 方法。

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(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)

備註

CodeMethodInvokeExpression 可用來表示叫用方法的表達式。

屬性 Method 會指定要叫用的方法。 屬性 Parameters 會指出要傳遞至 方法的參數。 CodeDirectionExpression使用 指定參數的欄位方向。

建構函式

CodeMethodInvokeExpression()

初始化 CodeMethodInvokeExpression 類別的新執行個體。

CodeMethodInvokeExpression(CodeExpression, String, CodeExpression[])

使用指定的目標物件、方法名稱和參數來初始化 CodeMethodInvokeExpression 類別的新執行個體。

CodeMethodInvokeExpression(CodeMethodReferenceExpression, CodeExpression[])

使用指定的方法和參數來初始化 CodeMethodInvokeExpression 類別的新執行個體。

屬性

Method

取得或設定要叫用的方法。

Parameters

取得一起叫用 (Invoke) 方法的參數。

UserData

取得目前物件的使用者可定義資料。

(繼承來源 CodeObject)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱