Get method using the specified binding constraints in CSharp

Description

The following code shows how to get method using the specified binding constraints.

Example


/* ww w. j  a  v  a2s  .  com*/
using System;
using System.Reflection;

class Program
{
    public void MethodA() { }
    static void Main(string[] args)
    {
        MethodInfo mInfo = typeof(Program).GetMethod("MethodA",
            BindingFlags.Public | BindingFlags.Instance);
        Console.WriteLine("Found method: {0}", mInfo);

    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Reflection »




Array
Constructor
Event
Field
Interface
Method
Properties
Type