_Type.InvokeMember Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides COM objects with version-independent access to the InvokeMember method.
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) |
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[]) |
Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) method. |
This method is for access to managed classes from unmanaged code, and should not be called from managed code.
The Type.InvokeMember method invokes a specific member of the current Type.
.
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
Public Function InvokeMember (name As String, invokeAttr As BindingFlags, binder As Binder, target As Object, args As Object()) As Object
Parameters
- name
- 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-
For IDispatch members, a string representing the DispID, for example "[DispID=3]".
- invokeAttr
- BindingFlags
A bitmask comprised of one or more BindingFlags that specify how the search is conducted. 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. If the type of lookup is omitted, BindingFlags.Public
| BindingFlags.Instance
will apply.
- 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
, to use the DefaultBinder.
- args
- Object[]
An array containing the arguments to pass to the member to invoke.
Returns
An Object representing the return value of the invoked member.
Remarks
This method is for access to managed classes from unmanaged code, and should not be called from managed code.
The Type.InvokeMember method invokes the specified member, using the specified binding constraints and matching the specified argument list.
Applies to
.NET Framework 4.8.1 og andre versjoner
Produkt | Versjoner |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
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
Public Function InvokeMember (name As String, invokeAttr As BindingFlags, binder As Binder, target As Object, args As Object(), culture As CultureInfo) As Object
Parameters
- name
- 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-
For IDispatch members, a string representing the DispID, for example "[DispID=3]".
- invokeAttr
- BindingFlags
A bitmask comprised of one or more BindingFlags that specify how the search is conducted. 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. If the type of lookup is omitted, BindingFlags.Public
| BindingFlags.Instance
will apply.
- 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
, to use the DefaultBinder.
- args
- Object[]
An array containing the arguments to pass to the member to invoke.
- culture
- CultureInfo
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
to use the current thread's CultureInfo.
Returns
An Object representing the return value of the invoked member.
Remarks
This method is for access to managed classes from unmanaged code, and should not be called from managed code.
The Type.InvokeMember method invokes the specified member, using the specified binding constraints and matching the specified argument list and culture.
Applies to
.NET Framework 4.8.1 og andre versjoner
Produkt | Versjoner |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
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
Public Function InvokeMember (name As String, invokeAttr As BindingFlags, binder As Binder, target As Object, args As Object(), modifiers As ParameterModifier(), culture As CultureInfo, namedParameters As String()) As Object
Parameters
- name
- 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-
For IDispatch members, a string representing the DispID, for example "[DispID=3]".
- invokeAttr
- BindingFlags
A bitmask comprised of one or more BindingFlags that specify how the search is conducted. 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. If the type of lookup is omitted, BindingFlags.Public
| BindingFlags.Instance
will apply.
- 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
, to use the DefaultBinder.
- args
- Object[]
An array containing the arguments to pass to the member to invoke.
- modifiers
- ParameterModifier[]
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
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
to use the current thread's CultureInfo.
- namedParameters
- String[]
An array containing the names of the parameters to which the values in the args
array are passed.
Returns
An Object representing the return value of the invoked member.
Remarks
This method is for access to managed classes from unmanaged code, and should not be called from managed code.
The Type.InvokeMember method invokes the specified member, using the specified binding constraints and matching the specified argument list, modifiers, and culture.
Applies to
.NET Framework 4.8.1 og andre versjoner
Produkt | Versjoner |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET-tilbakemelding
.NET er et åpen kilde-prosjekt. Velg en kobling for å gi tilbakemelding: