/// <summary> /// Describes the given Constructor /// </summary> /// <param name="c">the constructor info for which to get the information</param> /// <param name="index">the index of this constructor item</param> /// <param name="objectId">the unique id - provider for all object descriptors</param> /// <returns>a constructor descriptor for the given constructor info</returns> private static ConstructorDescriptor DescribeConstructor(ConstructorInfo c, int index, ref int objectId, Action <ParameterInfo, ConstructorParameterDescriptor> analyzeParameter) { ParameterInfo[] parameters = c.GetParameters().Where(n => n.ParameterType != obsoleteCallbackType).ToArray(); List <ConstructorParameterDescriptor> parameterDescriptors = new List <ConstructorParameterDescriptor>(); foreach (ParameterInfo param in parameters) { var arg = DescribeParameter(param, ref objectId); parameterDescriptors.Add(arg); analyzeParameter?.Invoke(param, arg); } ConstructorDescriptor retVal = new ConstructorDescriptor { Uid = objectId++, ConstructorName = string.Format(".ctor{0}", index + 1), Parameters = parameterDescriptors.ToArray(), Sample = GenerateSample(c, parameterDescriptors) }; return(retVal); }
/// <summary> /// Analyzes the the current constructor and extends the descriptor with custom information /// </summary> /// <param name="currentConstructor">the current constructor that is being described</param> /// <param name="descriptor">the constructor description that was estimated by the default-implementation</param> protected virtual void AnalyzeConstructor(ConstructorInfo currentConstructor, ConstructorDescriptor descriptor) { }