Type.IsAbstract Property  
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.
Gets a value indicating whether the Type is abstract and must be overridden.
public:
 property bool IsAbstract { bool get(); };public bool IsAbstract { get; }member this.IsAbstract : boolPublic ReadOnly Property IsAbstract As BooleanProperty Value
true if the Type is abstract; otherwise, false.
Implements
Examples
The following example creates an array of Type objects that represent the following types:contains type returns true if the specified object is abstract; otherwise, it returns false.
- AbstractClass, an abstract class (a class marked as- abstractin C# and- MustInheritin Visual Basic).
- DerivedClass, a class that inherits from- AbstractClass.
- SingleClass, a non-inheritable class. it's defined as- sealedin C# and- NotInheritablein Visual Basic.
- ITypeInfo, an interface.
- ImplementingClass, a class that implements the- ITypeInfointerface.
The method returns true only for AbstractClass, the abstract class, and ITypeInfo, the interface.
using System;
public abstract class AbstractClass
{}
public class DerivedClass : AbstractClass
{}
public sealed class SingleClass
{}
public interface ITypeInfo
{
   string GetName();
}
public class ImplementingClass : ITypeInfo
{
   public string GetName()
   {
      return this.GetType().FullName;
   }
}
delegate string InputOutput(string inp);
public class Example
{
   public static void Main()
   {
      Type[] types= { typeof(AbstractClass),
                      typeof(DerivedClass),
                      typeof(ITypeInfo),
                      typeof(SingleClass),
                      typeof(ImplementingClass),
                      typeof(InputOutput) };
      foreach (var type in types)
         Console.WriteLine("{0} is abstract: {1}",
                           type.Name, type.IsAbstract);
   }
}
// The example displays the following output:
//       AbstractClass is abstract: True
//       DerivedClass is abstract: False
//       ITypeInfo is abstract: True
//       SingleClass is abstract: False
//       ImplementingClass is abstract: False
//       InputOutput is abstract: False
[<AbstractClass>]
type AbstractClass() = class end
type DerivedClass() =  inherit AbstractClass()
[<Sealed>]
type SingleClass() = class end
type ITypeInfo =
   abstract GetName: unit -> string
type ImplementingClass() =
    interface ITypeInfo with
        member this.GetName() =
            this.GetType().FullName
type DiscriminatedUnion = 
    | Yes 
    | No of string
type Record = 
  { Name: string
    Age: int }
type InputOutput = delegate of inp: string -> string
let types = 
    [ typeof<AbstractClass>
      typeof<DerivedClass>
      typeof<ITypeInfo>
      typeof<SingleClass>
      typeof<ImplementingClass>
      typeof<DiscriminatedUnion>
      typeof<Record>
      typeof<InputOutput> ]
for typ in types do
    printfn $"{typ.Name} is abstract: {typ.IsAbstract}"
// The example displays the following output:
//       AbstractClass is abstract: True     
//       DerivedClass is abstract: False     
//       ITypeInfo is abstract: True
//       SingleClass is abstract: False      
//       ImplementingClass is abstract: False
//       DiscriminatedUnion is abstract: True
//       Record is abstract: False
//       InputOutput is abstract: False
Public MustInherit Class AbstractClass
End Class
Public Class DerivedClass : Inherits AbstractClass
End Class
Public NotInheritable Class SingleClass
End Class
Public Interface ITypeInfo
   Function GetName() As String
End Interface
Public Class ImplementingClass : Implements ITypeInfo
   Public Function GetName() As String _
          Implements ITypeInfo.GetName
      Return Me.GetType().FullName
   End Function
End Class
Delegate Function InputOutput(inp As String) As String
Module Example
   Public Sub Main()
      Dim types() As Type = { GetType(AbstractClass),
                              GetType(DerivedClass),
                              GetType(ITypeInfo),
                              GetType(SingleClass),
                              GetType(ImplementingClass),
                              GetType(InputOutput) }
      For Each type In types
         Console.WriteLine("{0} is abstract: {1}",
                           type.Name, type.IsAbstract)
      Next
   End Sub
End Module
' The example displays the following output:
'       AbstractClass is abstract: True
'       DerivedClass is abstract: False
'       ITypeInfo is abstract: True
'       SingleClass is abstract: False
'       ImplementingClass is abstract: False
'       InputOutput is abstract: False
Remarks
The IsAbstract property returns true in the following cases:
- The current type is abstract; that is, it cannot be instantiated, but can only serve as the base class for derived classes. In C#, abstract classes are marked with the abstract keyword; in F#, they are marked with the AbstractClass attribute; in Visual Basic, they are marked with the MustInherit keyword. 
- The current type is an interface. 
If the current Type represents a type parameter in the definition of a generic type or generic method, this property always returns false.