Share via


Class.PackageName Property

Definition

Returns the fully qualified package name.

public string PackageName { [Android.Runtime.Register("getPackageName", "()Ljava/lang/String;", "", ApiSince=31)] get; }
[<get: Android.Runtime.Register("getPackageName", "()Ljava/lang/String;", "", ApiSince=31)>]
member this.PackageName : string

Property Value

the fully qualified package name

Attributes

Remarks

Returns the fully qualified package name.

If this class is a top level class, then this method returns the fully qualified name of the package that the class is a member of, or the empty string if the class is in an unnamed package.

If this class is a member class, then this method is equivalent to invoking getPackageName() on the #getEnclosingClass enclosing class.

If this class is a #isLocalClass local class or an #isAnonymousClass() anonymous class, then this method is equivalent to invoking getPackageName() on the #getDeclaringClass declaring class of the #getEnclosingMethod enclosing method or #getEnclosingConstructor enclosing constructor.

If this class represents an array type then this method returns the package name of the element type. If this class represents a primitive type or void then the package name "java.lang" is returned.

Added in 9.

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

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