CSharp examples for System.Reflection:ConstructorInfo
Get Constructor Info
using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Reflection; using System.ComponentModel; using System.Collections.Generic; using System;/*from www . j a va 2 s. co m*/ public class Main{ private static ConstructorInfo GetConstructorInfo(object instance, Type[] parameterTypes) { if (instance == null) { throw new ArgumentNullException("instance"); } ConstructorInfo constructorInfo = instance.GetType().GetConstructor(parameterTypes); if (constructorInfo == null) { throw new ArgumentException(String.Format( "A matching constructor on type '{0}' could not be found.", instance.GetType().FullName)); } return constructorInfo; } }