C# TypeInfo IsAbstract

Description

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

Syntax

TypeInfo.IsAbstract has the following syntax.


public bool IsAbstract { get; }

Example

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


//from   w  w  w  .  jav a2 s.c o  m
using System;
using System.Reflection;
public abstract class MyAbstractClass 
{
}
public class MyClass
{
}
public class Type_IsAbstract
{
    public static void Main()
    {
        Console.WriteLine("MyAbstractClass is {0}", (typeof(MyAbstractClass).IsAbstract) ? "an abstract class." : "not an abstract class.");
        Console.WriteLine("MyClass is {0}", (typeof(MyClass).IsAbstract) ? "an abstract class." : "not an abstract class.");
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo