_Type.InvokeMember 方法

定義

為 COM 物件提供與版本無關的 InvokeMember 方法之存取權。Provides COM objects with version-independent access to the InvokeMember method.

多載

InvokeMember(String, BindingFlags, Binder, Object, Object[])

為 COM 物件提供與版本無關的 InvokeMember(String, BindingFlags, Binder, Object, Object[]) 方法之存取權。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[]) method.

InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo)

為 COM 物件提供與版本無關的 InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) 方法之存取權。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) method.

InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])

為 COM 物件提供與版本無關的 InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) 方法之存取權。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) method.

備註

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

方法會叫用目前Type的特定成員。 Type.InvokeMemberThe Type.InvokeMember method invokes a specific member of the current Type.

執行個體時提供 SQL Server 登入。.

InvokeMember(String, BindingFlags, Binder, Object, Object[])

為 COM 物件提供與版本無關的 InvokeMember(String, BindingFlags, Binder, Object, Object[]) 方法之存取權。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[]) method.

public:
 System::Object ^ InvokeMember(System::String ^ name, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, System::Object ^ target, cli::array <System::Object ^> ^ args);
public object InvokeMember (string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args);
abstract member InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj[] -> obj

參數

name
String

String,包含要叫用的建構函式、方法、屬性或欄位成員的名稱。The String containing the name of the constructor, method, property, or field member to invoke.

-或--or- 空字串 (""),要叫用預設成員。An empty string ("") to invoke the default member.

-或--or- 若為 IDispatch 成為,則為代表 DispID 的字串,例如 "[DispID=3]"。For IDispatch members, a string representing the DispID, for example "[DispID=3]".

invokeAttr
BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted. 該存取可以是其中一個 BindingFlags,例如 PublicNonPublicPrivateInvokeMethodGetField 等等。The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. 不需要指定查閱的類型。The type of lookup need not be specified. 如果省略查閱的類型,則會套用 BindingFlags.Public | BindingFlags.InstanceIf the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance will apply.

binder
Binder

Binder 物件,定義一組屬性並啟用繫結,可包含多載方法的選擇、引數類型的強制型轉,以及透過反映的成員引動過程。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

-或--or- null,則使用 DefaultBindernull, to use the DefaultBinder.

target
Object

要叫用指定成員的 ObjectThe Object on which to invoke the specified member.

args
Object[]

包含引數的陣列,這些引數會傳遞給要叫用的成員。An array containing the arguments to pass to the member to invoke.

傳回

Object,表示叫用之成員的傳回值。An Object representing the return value of the invoked member.

備註

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.InvokeMember方法會使用指定的系結條件約束並符合指定的引數清單,來叫用指定的成員。The Type.InvokeMember method invokes the specified member, using the specified binding constraints and matching the specified argument list.

InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo)

為 COM 物件提供與版本無關的 InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) 方法之存取權。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) method.

public:
 System::Object ^ InvokeMember(System::String ^ name, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, System::Object ^ target, cli::array <System::Object ^> ^ args, System::Globalization::CultureInfo ^ culture);
public object InvokeMember (string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Globalization.CultureInfo culture);
abstract member InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj[] * System.Globalization.CultureInfo -> obj

參數

name
String

String,包含要叫用的建構函式、方法、屬性或欄位成員的名稱。The String containing the name of the constructor, method, property, or field member to invoke.

-或--or- 空字串 (""),要叫用預設成員。An empty string ("") to invoke the default member.

-或--or- 若為 IDispatch 成為,則為代表 DispID 的字串,例如 "[DispID=3]"。For IDispatch members, a string representing the DispID, for example "[DispID=3]".

invokeAttr
BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted. 該存取可以是其中一個 BindingFlags,例如 PublicNonPublicPrivateInvokeMethodGetField 等等。The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. 不需要指定查閱的類型。The type of lookup need not be specified. 如果省略查閱的類型,則會套用 BindingFlags.Public | BindingFlags.InstanceIf the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance will apply.

binder
Binder

Binder 物件,定義一組屬性並啟用繫結,可包含多載方法的選擇、引數類型的強制型轉,以及透過反映的成員引動過程。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

-或--or- null,則使用 DefaultBindernull, to use the DefaultBinder.

target
Object

要叫用指定成員的 ObjectThe Object on which to invoke the specified member.

args
Object[]

包含引數的陣列,這些引數會傳遞給要叫用的成員。An array containing the arguments to pass to the member to invoke.

culture
CultureInfo

CultureInfo 物件,代表要使用的全球化地區設定,進行特定地區設定轉換時可能需要這個物件,例如將數值的 String 轉換成 Double。The CultureInfo object representing the globalization locale to use, which may be necessary for locale-specific conversions, such as converting a numeric String to a Double.

-或--or- null,則使用目前執行緒的 CultureInfonull to use the current thread's CultureInfo.

傳回

Object,表示叫用之成員的傳回值。An Object representing the return value of the invoked member.

備註

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.InvokeMember方法會使用指定的系結條件約束並符合指定的引數清單和文化特性,來叫用指定的成員。The Type.InvokeMember method invokes the specified member, using the specified binding constraints and matching the specified argument list and culture.

InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])

為 COM 物件提供與版本無關的 InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) 方法之存取權。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) method.

public:
 System::Object ^ InvokeMember(System::String ^ name, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, System::Object ^ target, cli::array <System::Object ^> ^ args, cli::array <System::Reflection::ParameterModifier> ^ modifiers, System::Globalization::CultureInfo ^ culture, cli::array <System::String ^> ^ namedParameters);
public object InvokeMember (string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters);
abstract member InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj[] * System.Reflection.ParameterModifier[] * System.Globalization.CultureInfo * string[] -> obj

參數

name
String

String,包含要叫用的建構函式、方法、屬性或欄位成員的名稱。The String containing the name of the constructor, method, property, or field member to invoke.

-或--or- 空字串 (""),要叫用預設成員。An empty string ("") to invoke the default member.

-或--or- 若為 IDispatch 成為,則為代表 DispID 的字串,例如 "[DispID=3]"。For IDispatch members, a string representing the DispID, for example "[DispID=3]".

invokeAttr
BindingFlags

位元遮罩,由一或多個 BindingFlags 組成,而這些旗標會指定執行搜尋的方式。A bitmask comprised of one or more BindingFlags that specify how the search is conducted. 該存取可以是其中一個 BindingFlags,例如 PublicNonPublicPrivateInvokeMethodGetField 等等。The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. 不需要指定查閱的類型。The type of lookup need not be specified. 如果省略查閱的類型,則會套用 BindingFlags.Public | BindingFlags.InstanceIf the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance will apply.

binder
Binder

Binder 物件,定義一組屬性並啟用繫結,可包含多載方法的選擇、引數類型的強制型轉,以及透過反映的成員引動過程。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

-或--or- null,則使用 DefaultBindernull, to use the DefaultBinder.

target
Object

要叫用指定成員的 ObjectThe Object on which to invoke the specified member.

args
Object[]

包含引數的陣列,這些引數會傳遞給要叫用的成員。An array containing the arguments to pass to the member to invoke.

modifiers
ParameterModifier[]

ParameterModifier 物件的陣列,代表在 args 陣列中與對應項目關聯的屬性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the args array. 參數的關聯屬性儲存在成員的簽章中。A parameter's associated attributes are stored in the member's signature. 預設的繫結器不會處理這個參數。The default binder does not process this parameter.

culture
CultureInfo

CultureInfo 物件,代表要使用的全球化地區設定,進行特定地區設定轉換時可能需要這個物件,例如將數值的 String 轉換成 Double。The CultureInfo object representing the globalization locale to use, which may be necessary for locale-specific conversions, such as converting a numeric String to a Double.

-或--or- null,則使用目前執行緒的 CultureInfonull to use the current thread's CultureInfo.

namedParameters
String[]

陣列,包含 args 陣列中的值所要傳遞之目標參數的名稱。An array containing the names of the parameters to which the values in the args array are passed.

傳回

Object,表示叫用之成員的傳回值。An Object representing the return value of the invoked member.

備註

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.InvokeMember方法會使用指定的系結條件約束並符合指定的引數清單、修飾詞和文化特性,來叫用指定的成員。The Type.InvokeMember method invokes the specified member, using the specified binding constraints and matching the specified argument list, modifiers, and culture.

適用於