Udostępnij za pośrednictwem


Class.IsAssignableFrom(Class) Method

Definition

Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter.

[Android.Runtime.Register("isAssignableFrom", "(Ljava/lang/Class;)Z", "")]
public bool IsAssignableFrom (Java.Lang.Class cls);
[<Android.Runtime.Register("isAssignableFrom", "(Ljava/lang/Class;)Z", "")>]
member this.IsAssignableFrom : Java.Lang.Class -> bool

Parameters

cls
Class

the Class object to be checked

Returns

the boolean value indicating whether objects of the type cls can be assigned to objects of this class

Attributes

Remarks

Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter. It returns true if so; otherwise it returns false. If this Class object represents a primitive type, this method returns true if the specified Class parameter is exactly this Class object; otherwise it returns false.

Specifically, this method tests whether the type represented by the specified Class parameter can be converted to the type represented by this Class object via an identity conversion or via a widening reference conversion. See <em>The Java Language Specification</em>, sections 5.1.1 and 5.1.4 , for details.

Added in 1.1.

Java documentation for java.lang.Class.isAssignableFrom(java.lang.Class<?>).

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