IsInstanceOfType Method
TOC
Collapse the table of content
Expand the table of content

Type.IsInstanceOfType Method (Object)

 

Determines whether the specified object is an instance of the current Type.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

abstract IsInstanceOfType : 
        o:Object -> bool
override IsInstanceOfType : 
        o:Object -> bool

Parameters

o
Type: System.Object

The object to compare with the current type.

Return Value

Type: System.Boolean

true if the current Type is in the inheritance hierarchy of the object represented by o, or if the current Type is an interface that oimplements. false if neither of these conditions is the case, if o is null, or if the current Type is an open generic type (that is, ContainsGenericParameters returns true).

This method can be overridden by a derived class.

System_CAPS_noteNote

A constructed type is not an instance of its generic type definition. That is, MyGenericList<int> (MyGenericList(Of Integer) in Visual Basic) is not an instance of MyGenericList<T> (MyGenericList(Of T) in Visual Basic).

The following example demonstrates the use of the IsInstanceOfType method.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft