C# MethodInfo IsAbstract

Description

MethodInfo IsAbstract Gets a value indicating whether the method is abstract.

Syntax

MethodInfo.IsAbstract has the following syntax.


public bool IsAbstract { get; }

Example

The following example determines whether specified the method is abstract and displays the result.


using System;//from  ww  w. j a v a2  s .  co m
using System.Reflection;

class methodbase
{
    public static int Main(string[] args)
    {      
        Type MyType1 = Type.GetType("System.Runtime.Serialization.Formatter");       
        Type MyType2 = Type.GetType("System.Reflection.MethodBase");
        MethodBase Mymethodbase1 = MyType1.GetMethod("WriteInt32", BindingFlags.NonPublic|BindingFlags.Instance);

        MethodBase Mymethodbase2 = MyType2.GetMethod("GetCurrentMethod", BindingFlags.Public|BindingFlags.Static);

        Console.Write("\nMymethodbase = " + Mymethodbase1.ToString());
        Console.Write(Mymethodbase1.IsAbstract);
        return 0;
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo