private string[] GetParameters() { var parameters = methodConfig.GetApplicableParameters(); var list = new List <string>(); foreach (var param in parameters) { var paramName = methodConfig.Method.GetValue(param.Name).TrimStart('@'); var desc = param.Description; if (methodConfig.MethodType == MethodType.Stream && param.StreamDescription != null) { desc = param.StreamDescription; } var description = methodConfig.Method.GetValue(desc).Split(new[] { "\\n" }, StringSplitOptions.None); if (description == null || description.Length == 1 && string.IsNullOrEmpty(description[0])) { throw xmlHelper.ThrowMissing($"description on parameter '{param.Name}'"); } list.AddRange(GetMultiLineXmlDoc(description, $"param name=\"{paramName}\"", "param")); } return(list.ToArray()); }
private ReadOnlyCollection <HeaderParameter> GetParameters() { var parameters = methodConfig.GetApplicableParameters(); var list = new List <HeaderParameter>(); var canHaveDefaultParameters = CanHaveDefaultParameters(parameters); foreach (var param in parameters) { if (string.IsNullOrEmpty(param.Name)) { throw new InvalidOperationException($"MethodDef '{methodConfig.MethodDef}' has unnamed parameters"); } if (string.IsNullOrEmpty(param.Type)) { throw new InvalidOperationException($"Parameter '{param.Name}' of methoddef '{methodConfig.MethodDef}' doesn't have a type"); } var @default = param.Default; if (methodConfig.MethodType == MethodType.Stream && param.StreamDefault != null) { @default = param.StreamDefault; } if (!canHaveDefaultParameters) { @default = null; } var type = methodConfig.Method.GetValue(param.Type); var name = methodConfig.Method.GetValue(param.Name); var parameter = MakeParameter(parameters, type, name, @default); list.Add(parameter); } return(list.ToReadOnlyList()); }