Export (0) Print
Expand All
Expand Minimize

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.5.2, 4.5.1, 4.5, 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

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft