EnumBuilder.GetMethods(BindingFlags) 方法

定义

按照指定,返回此类型声明或继承的所有公共和非公共方法。Returns all the public and non-public methods declared or inherited by this type, as specified.

public:
 override cli::array <System::Reflection::MethodInfo ^> ^ GetMethods(System::Reflection::BindingFlags bindingAttr);
public override System.Reflection.MethodInfo[] GetMethods (System.Reflection.BindingFlags bindingAttr);
override this.GetMethods : System.Reflection.BindingFlags -> System.Reflection.MethodInfo[]
Public Overrides Function GetMethods (bindingAttr As BindingFlags) As MethodInfo()

参数

bindingAttr
BindingFlags

这必须是来自 BindingFlags 的位标志,例如 InvokeMethodNonPublic 等等。This must be a bit flag from BindingFlags, such as InvokeMethod, NonPublic, and so on.

返回

如果使用 nonPublic,则返回 MethodInfo 对象数组,表示在该类型上定义的公共和非公共方法;否则,仅返回公共方法。Returns an array of MethodInfo objects representing the public and non-public methods defined on this type if nonPublic is used; otherwise, only the public methods are returned.

异常

在不完整类型中目前不支持此方法。This method is not currently supported in types that are not complete.

注解

解决方法:若要检索已完成类型的方法,请使用Type.GetTypeAssembly.GetType检索该类型,并在检索到的类型上使用反射。As a workaround, to retrieve the methods of a finished type, retrieve the type using Type.GetType or Assembly.GetType and use reflection on the retrieved type.

适用于