Class.IsInstance(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Determines if the specified Object
is assignment-compatible
with the object represented by this Class
.
[Android.Runtime.Register("isInstance", "(Ljava/lang/Object;)Z", "")]
public bool IsInstance (Java.Lang.Object? obj);
[<Android.Runtime.Register("isInstance", "(Ljava/lang/Object;)Z", "")>]
member this.IsInstance : Java.Lang.Object -> bool
Parameters
- obj
- Object
the object to check
Returns
true if obj
is an instance of this class
- Attributes
Remarks
Determines if the specified Object
is assignment-compatible with the object represented by this Class
. This method is the dynamic equivalent of the Java language instanceof
operator. The method returns true
if the specified Object
argument is non-null and can be cast to the reference type represented by this Class
object without raising a ClassCastException.
It returns false
otherwise.
Specifically, if this Class
object represents a declared class, this method returns true
if the specified Object
argument is an instance of the represented class (or of any of its subclasses); it returns false
otherwise. If this Class
object represents an array class, this method returns true
if the specified Object
argument can be converted to an object of the array class by an identity conversion or by a widening reference conversion; it returns false
otherwise. If this Class
object represents an interface, this method returns true
if the class or any superclass of the specified Object
argument implements this interface; it returns false
otherwise. If this Class
object represents a primitive type, this method returns false
.
Added in 1.1.
Java documentation for java.lang.Class.isInstance(java.lang.Object)
.
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.