private IEnumerable <CtorInformation> GetCtorInformations(Type type) { var constructors = type .GetConstructors() .OrderByDescending(c => c.GetParameters().Length); foreach (var constructor in constructors) { var info = new CtorInformation(constructor); BuildCtorInformation(info); yield return(info); } }
private void BuildCtorInformation(CtorInformation info) { var func = info.Length > 0 ? (Action <ParameterInfo, TypeInformation>)info.Update : info.Add; foreach (var parameter in info.GetParameters()) { if (typeRegister.TryGetValue(parameter.ParameterType, out var searchType) && typeInformationRegister.TryGetValue(searchType, out var typeInformation)) { func(parameter, typeInformation); } else { func(parameter, null); } } }