CSharp examples for System.Reflection:Constructor
Get Default Constructor
using System.Reflection; using System.Collections.Generic; using System;/*from ww w .j a va 2 s . co m*/ public class Main{ public static ConstructorInfo GetDefaultConstructor(Type type) { ConstructorInfo constructor = type.GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[0], null); if (constructor == null) { throw new JsonException(type.FullName + " must have a parameterless constructor"); } return constructor; } }