Module.GetMethod 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回具有指定条件的方法。
重载
| 名称 | 说明 |
|---|---|
| GetMethod(String) |
返回具有指定名称的方法。 |
| GetMethod(String, Type[]) |
返回具有指定名称和参数类型的方法。 |
| GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) |
返回具有指定名称、绑定信息、调用约定和参数类型和修饰符的方法。 |
GetMethod(String)
- Source:
- Module.cs
- Source:
- Module.cs
- Source:
- Module.cs
- Source:
- Module.cs
- Source:
- Module.cs
返回具有指定名称的方法。
public:
System::Reflection::MethodInfo ^ GetMethod(System::String ^ name);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Methods might be removed")]
public System.Reflection.MethodInfo? GetMethod(string name);
public System.Reflection.MethodInfo GetMethod(string name);
public System.Reflection.MethodInfo? GetMethod(string name);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Methods might be removed")>]
member this.GetMethod : string -> System.Reflection.MethodInfo
member this.GetMethod : string -> System.Reflection.MethodInfo
Public Function GetMethod (name As String) As MethodInfo
参数
- name
- String
方法名称。
返回
MethodInfo具有指定名称的对象,或者null方法不存在。
- 属性
例外
name 是 null。
适用于
GetMethod(String, Type[])
- Source:
- Module.cs
- Source:
- Module.cs
- Source:
- Module.cs
- Source:
- Module.cs
- Source:
- Module.cs
返回具有指定名称和参数类型的方法。
public:
System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, cli::array <Type ^> ^ types);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Methods might be removed")]
public System.Reflection.MethodInfo? GetMethod(string name, Type[] types);
public System.Reflection.MethodInfo GetMethod(string name, Type[] types);
public System.Reflection.MethodInfo? GetMethod(string name, Type[] types);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Methods might be removed")>]
member this.GetMethod : string * Type[] -> System.Reflection.MethodInfo
member this.GetMethod : string * Type[] -> System.Reflection.MethodInfo
Public Function GetMethod (name As String, types As Type()) As MethodInfo
参数
- name
- String
方法名称。
- types
- Type[]
要搜索的参数类型。
返回
MethodInfo根据指定的条件或null方法不存在的对象。
- 属性
例外
name is null、 types is null或 types (i) is null.
适用于
GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])
- Source:
- Module.cs
- Source:
- Module.cs
- Source:
- Module.cs
- Source:
- Module.cs
- Source:
- Module.cs
返回具有指定名称、绑定信息、调用约定和参数类型和修饰符的方法。
public:
System::Reflection::MethodInfo ^ GetMethod(System::String ^ name, System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, System::Reflection::CallingConventions callConvention, cli::array <Type ^> ^ types, cli::array <System::Reflection::ParameterModifier> ^ modifiers);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Methods might be removed")]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, Type[] types, System.Reflection.ParameterModifier[]? modifiers);
public System.Reflection.MethodInfo GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, Type[] types, System.Reflection.ParameterModifier[] modifiers);
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, Type[] types, System.Reflection.ParameterModifier[]? modifiers);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Methods might be removed")>]
member this.GetMethod : string * System.Reflection.BindingFlags * System.Reflection.Binder * System.Reflection.CallingConventions * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.MethodInfo
member this.GetMethod : string * System.Reflection.BindingFlags * System.Reflection.Binder * System.Reflection.CallingConventions * Type[] * System.Reflection.ParameterModifier[] -> System.Reflection.MethodInfo
Public Function GetMethod (name As String, bindingAttr As BindingFlags, binder As Binder, callConvention As CallingConventions, types As Type(), modifiers As ParameterModifier()) As MethodInfo
参数
- name
- String
方法名称。
- bindingAttr
- BindingFlags
用于控制搜索的 BindingFlags 位标志之一。
- binder
- Binder
一个实现 Binder的对象,其中包含与此方法相关的属性。
- callConvention
- CallingConventions
方法的调用约定。
- types
- Type[]
要搜索的参数类型。
- modifiers
- ParameterModifier[]
一个参数修饰符数组,用于使绑定能够处理已修改类型的参数签名。
返回
MethodInfo根据指定的条件或null方法不存在的对象。
- 属性
例外
name is null、 types is null或 types (i) is null.