共用方式為


Class.EnclosingConstructor Property

Definition

If this Class object represents a local or anonymous class within a constructor, returns a java.lang.reflect.Constructor Constructor object representing the immediately enclosing constructor of the underlying class.

public Java.Lang.Reflect.Constructor? EnclosingConstructor { [Android.Runtime.Register("getEnclosingConstructor", "()Ljava/lang/reflect/Constructor;", "")] get; }
[<get: Android.Runtime.Register("getEnclosingConstructor", "()Ljava/lang/reflect/Constructor;", "")>]
member this.EnclosingConstructor : Java.Lang.Reflect.Constructor

Property Value

the immediately enclosing constructor of the underlying class, if that class is a local or anonymous class; otherwise null.

Attributes

Remarks

If this Class object represents a local or anonymous class within a constructor, returns a java.lang.reflect.Constructor Constructor object representing the immediately enclosing constructor of the underlying class. Returns null otherwise. In particular, this method returns null if the underlying class is a local or anonymous class immediately enclosed by a type declaration, instance initializer or static initializer.

Added in 1.5.

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

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