CSharp examples for System.Reflection:ConstructorInfo
Get Public Or Protected Constructors from Type
using System.Linq.Expressions; using System.Reflection; using System.Text; using System.Linq; using System.Collections.Generic; using System;//from www . jav a2s .co m public class Main{ public static ConstructorInfo[] GetPublicOrProtectedConstructors(Type t) { var cs = t.GetConstructors(InstanceFlag); var list = new List<ConstructorInfo>(); foreach (ConstructorInfo info in cs) { if (info.IsPublic || info.IsFamily) { list.Add(info); } } return list.ToArray(); } }