共用方式為


Class.GetConstructors Method

Definition

Returns an array containing Constructor objects reflecting all the public constructors of the class represented by this Class object.

[Android.Runtime.Register("getConstructors", "()[Ljava/lang/reflect/Constructor;", "")]
public Java.Lang.Reflect.Constructor[] GetConstructors ();
[<Android.Runtime.Register("getConstructors", "()[Ljava/lang/reflect/Constructor;", "")>]
member this.GetConstructors : unit -> Java.Lang.Reflect.Constructor[]

Returns

the array of Constructor objects representing the public constructors of this class

Attributes

Remarks

Returns an array containing Constructor objects reflecting all the public constructors of the class represented by this Class object. An array of length 0 is returned if the class has no public constructors, or if the class is an array class, or if the class reflects a primitive type or void.

Note that while this method returns an array of Constructor<T> objects (that is an array of constructors from this class), the return type of this method is Constructor<?>[] and <em>not</em> Constructor<T>[] as might be expected. This less informative return type is necessary since after being returned from this method, the array could be modified to hold Constructor objects for different classes, which would violate the type guarantees of Constructor<T>[].

Added in 1.1.

Java documentation for java.lang.Class.getConstructors().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also