CodeMethodInvokeExpression CodeMethodInvokeExpression CodeMethodInvokeExpression CodeMethodInvokeExpression Class

定義

表示叫用 (Invoke) 方法的運算式。Represents an expression that invokes a method.

public ref class CodeMethodInvokeExpression : System::CodeDom::CodeExpression
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeMethodInvokeExpression : System.CodeDom.CodeExpression
type CodeMethodInvokeExpression = class
    inherit CodeExpression
Public Class CodeMethodInvokeExpression
Inherits CodeExpression
繼承
CodeMethodInvokeExpressionCodeMethodInvokeExpressionCodeMethodInvokeExpressionCodeMethodInvokeExpression
屬性

範例

這個範例示範CodeMethodInvokeExpression如何使用來叫用方法。This example demonstrates using a CodeMethodInvokeExpression to invoke a method.

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可用來代表叫用方法的運算式。CodeMethodInvokeExpression can be used to represent an expression that invokes a method.

Method屬性會指定要叫用的方法。The Method property specifies the method to invoke. Parameters屬性會指出要傳遞給方法的參數。The Parameters property indicates the parameters to pass to the method. CodeDirectionExpression使用來指定參數的欄位方向。Use a CodeDirectionExpression to specify the field direction of a parameter.

建構函式

CodeMethodInvokeExpression() CodeMethodInvokeExpression() CodeMethodInvokeExpression() CodeMethodInvokeExpression()

初始化 CodeMethodInvokeExpression 類別的新執行個體。Initializes a new instance of the CodeMethodInvokeExpression class.

CodeMethodInvokeExpression(CodeExpression, String, CodeExpression[]) CodeMethodInvokeExpression(CodeExpression, String, CodeExpression[]) CodeMethodInvokeExpression(CodeExpression, String, CodeExpression[]) CodeMethodInvokeExpression(CodeExpression, String, CodeExpression[])

使用指定的目標物件、方法名稱和參數來初始化 CodeMethodInvokeExpression 類別的新執行個體。Initializes a new instance of the CodeMethodInvokeExpression class using the specified target object, method name, and parameters.

CodeMethodInvokeExpression(CodeMethodReferenceExpression, CodeExpression[]) CodeMethodInvokeExpression(CodeMethodReferenceExpression, CodeExpression[]) CodeMethodInvokeExpression(CodeMethodReferenceExpression, CodeExpression[]) CodeMethodInvokeExpression(CodeMethodReferenceExpression, CodeExpression[])

使用指定的方法和參數來初始化 CodeMethodInvokeExpression 類別的新執行個體。Initializes a new instance of the CodeMethodInvokeExpression class using the specified method and parameters.

屬性

Method Method Method Method

取得或設定要叫用的方法。Gets or sets the method to invoke.

Parameters Parameters Parameters Parameters

取得一起叫用 (Invoke) 方法的參數。Gets the parameters to invoke the method with.

UserData UserData UserData UserData

取得目前物件的使用者可定義資料。Gets the user-definable data for the current object.

(Inherited from CodeObject)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於

另請參閱