Check if a method is final in CSharp
Description
The following code shows how to check if a method is final.
Example
using System;/*from w w w . j a va 2 s .c o m*/
using System.Reflection;
public class MyClass
{
public void MyMethod()
{
}
public static void Main()
{
MethodBase m = typeof(MyClass).GetMethod("MyMethod");
Console.WriteLine("The IsFinal property value of MyMethod is {0}.", m.IsFinal);
Console.WriteLine("The IsVirtual property value of MyMethod is {0}.", m.IsVirtual);
}
}
The code above generates the following result.