Searches for the constructors defined for the current Type, using the specified BindingFlags. : BindingFlags « Reflection « C# / C Sharp






Searches for the constructors defined for the current Type, using the specified BindingFlags.

 

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();
        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.GetConstructors(BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Instance)
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