Export (0) Print
Expand All

Type.IsAbstract Property

Gets a value indicating whether the Type is abstract and must be overridden.

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

'Declaration
Public ReadOnly Property IsAbstract As Boolean

Property Value

Type: System.Boolean
true if the Type is abstract; otherwise, false.

Implements

_Type.IsAbstract

If the current Type represents a type parameter in the definition of a generic type or generic method, this property always returns false.

The following example returns true if the specified object is abstract; otherwise, it returns false.


Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic
Public MustInherit Class MyMustInheritClass
End Class 'MyMustInheritClass
Public Class [MyClass]
End Class '[MyClass]
Public Class Type_IsMustInherit
    Public Shared Sub Main()
        Try
            ' Check whether the return type of MyMustInheritClass is MustInherit or not.
            Console.WriteLine(ControlChars.NewLine + "Checking whether the type is MustInherit." + ControlChars.NewLine)

            If GetType([MyMustInheritClass]).IsAbstract = True Then
                Console.WriteLine("MyMustInheritClass is {0}", "a MustInherit class.")
            Else
                Console.WriteLine("MyMustInheritClass is {0}", "not a MustInherit class.")
            End If
            ' Check whether the return type of MyClass is MustInherit or not.
            If GetType([MyClass]).IsAbstract = True Then
                Console.WriteLine("MyClass is {0}", "a MustInherit class.")
            Else
                Console.WriteLine("MyClass is {0}", "not a MustInherit class.")
            End If
        Catch e As Exception
            Console.WriteLine("Exception: {0} " + ControlChars.Cr, e.Message.ToString())
        End Try
    End Sub 'Main
End Class 'Type_IsMustInherit


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2015 Microsoft