GetConstructors(BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Instance) : BindingFlags « Reflection « C# / C Sharp






GetConstructors(BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Instance)

 

using System;
using System.Reflection;

public class t {
    public t() {}
    static t() {}
    public t(int i) {}

    public static void Main() {
        ConstructorInfo[] p = typeof(t).GetConstructors(
           BindingFlags.Public | BindingFlags.Static |
           BindingFlags.NonPublic | BindingFlags.Instance);
        Console.WriteLine(p.Length);

        for (int i=0;i<p.Length;i++) {
            Console.WriteLine(p[i].IsStatic);
        }
    }
}

   
  








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.Using difference BindingFlags to get method
5.BindingFlags.Public | BindingFlags.Instance
6.BindingFlags.NonPublic|BindingFlags.Instance|BindingFlags.DeclaredOnly
7.Get Nested Types with BindingFlags
8.Get Properties with BindingFlags