C# MethodInfo IsVirtual

Description

MethodInfo IsVirtual Gets a value indicating whether the method is virtual.

Syntax

MethodInfo.IsVirtual has the following syntax.


public bool IsVirtual { get; }

Example


using System;/*w  w  w.  j av a  2  s  .  co  m*/
using System.Reflection;

public class MyClass 
{
    public void MyMethod() 
    {
    }
    public static void Main() 
    {
        MethodBase m = typeof(MyClass).GetMethod("MyMethod");
        Console.WriteLine(m.IsFinal);
        Console.WriteLine(m.IsVirtual);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo