Android Guides | Samples

Java.Lang.Object.Class Property

Returns the unique instance of Class that represents this object's class.

Syntax

[get: Android.Runtime.Register("getClass", "()Ljava/lang/Class;", "GetGetClassHandler")]
public Class Class { get; }

Remarks

Returns the unique instance of Class that represents this object's class. Note that getClass() is a special case in that it actually returns Class<? extends Foo> where Foo is the erasure of the type of the expression getClass() was called upon.

As an example, the following code actually compiles, although one might think it shouldn't:

java Example

List l = new ArrayList();
   Class<? extends List> c = l.getClass();

[Android Documentation]

Requirements

Namespace: Java.Lang
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1