EnumBuilder.GetConstructors(BindingFlags) 方法
定义
按照指定,返回 ConstructorInfo 对象的数组,表示为此类定义的公共和非公共构造函数。Returns an array of ConstructorInfo objects representing the public and non-public constructors defined for this class, as specified.
public:
override cli::array <System::Reflection::ConstructorInfo ^> ^ GetConstructors(System::Reflection::BindingFlags bindingAttr);
public override System.Reflection.ConstructorInfo[] GetConstructors (System.Reflection.BindingFlags bindingAttr);
[System.Runtime.InteropServices.ComVisible(true)]
public override System.Reflection.ConstructorInfo[] GetConstructors (System.Reflection.BindingFlags bindingAttr);
override this.GetConstructors : System.Reflection.BindingFlags -> System.Reflection.ConstructorInfo[]
[<System.Runtime.InteropServices.ComVisible(true)>]
override this.GetConstructors : System.Reflection.BindingFlags -> System.Reflection.ConstructorInfo[]
Public Overrides Function GetConstructors (bindingAttr As BindingFlags) As ConstructorInfo()
参数
- bindingAttr
- BindingFlags
这必须是来自 BindingFlags 的位标志:InvokeMethod、NonPublic 等等。This must be a bit flag from BindingFlags : InvokeMethod, NonPublic, and so on.
返回
返回 ConstructorInfo 对象的数组,表示为此类定义的指定构造函数。Returns an array of ConstructorInfo objects representing the specified constructors defined for this class. 如果未定义任何构造函数,则返回一个空数组。If no constructors are defined, an empty array is returned.
- 属性
例外
不完整类型目前不支持此方法。This method is not currently supported in types that are not complete.
注解
作为一种解决方法,若要检索已完成类型的构造函数,可以使用或检索该类型, Type.GetType Assembly.GetType 并在检索到的类型上使用反射。As a workaround, to retrieve the constructor of a finished type, you can retrieve the type using Type.GetType or Assembly.GetType and use reflection on the retrieved type.