Partager via


Object.Class Property

Definition

Returns the runtime class of this Object.

public Java.Lang.Class Class { [Android.Runtime.Register("getClass", "()Ljava/lang/Class;", "")] get; }
[<get: Android.Runtime.Register("getClass", "()Ljava/lang/Class;", "")>]
member this.Class : Java.Lang.Class

Property Value

The Class object that represents the runtime class of this object.

Attributes

Remarks

Returns the runtime class of this Object. The returned Class object is the object that is locked by static synchronized methods of the represented class.

<b>The actual result type is Class<? extends |X|> where |X| is the erasure of the static type of the expression on which getClass is called.</b> For example, no cast is required in this code fragment:

Number n = 0;<br> Class<? extends Number> c = n.getClass();

Java documentation for java.lang.Object.getClass().

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