BindingFlags.Public | BindingFlags.Instance : BindingFlags « Reflection « C# / C Sharp






BindingFlags.Public | BindingFlags.Instance

 

using System;
using System.Reflection;

class Program
{
    public void MethodA(int i, int j) { }
    public void MethodA(int[] i) { }
    public unsafe void MethodA(int* i) { }
    public void MethodA(ref int r) {}
    public void MethodA(int i, out int o) { o = 100; }


  static void Main(string[] args)
  {
    MethodInfo mInfo;

    mInfo = typeof(Program).GetMethod("MethodA",BindingFlags.Public | BindingFlags.Instance,
        null,
        new Type[] { typeof(int), typeof(int) },
        null);
    Console.WriteLine("Found method: {0}", mInfo);


  }
}

   
  








Related examples in the same category

1.Use BindingFlags Instance and NonPublic
2.Print Method Info: BindingFlags
3.Searches for the constructors defined for the current Type, using the specified BindingFlags.
4.GetConstructors(BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Instance)
5.Using difference BindingFlags to get method
6.BindingFlags.NonPublic|BindingFlags.Instance|BindingFlags.DeclaredOnly
7.Get Nested Types with BindingFlags
8.Get Properties with BindingFlags