Android Guides | Samples

Java.Lang.Class.Cast Method

Casts the given object to the type represented by this Class.

Syntax

[Android.Runtime.Register("cast", "(Ljava/lang/Object;)Ljava/lang/Object;", "")]
public Object Cast (Object obj)

Parameters

obj

Exceptions

TypeReason
ClassCastExceptionif the object cannot be cast to the given type.

Remarks

Casts the given object to the type represented by this Class. If the object is null then the result is also null.

[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