static public void ValidateParameterValues(ParameterValueCollection parameters, IList <IParameter> ps, IActionMethodPointer owner) { List <ParameterValue> pvs = new List <ParameterValue>(); for (int i = 0; i < ps.Count; i++) { bool bFound = false; foreach (ParameterValue pv in parameters) { if (string.Compare(ps[i].Name, pv.Name, StringComparison.Ordinal) == 0) { bFound = true; DataTypePointer dp = ps[i] as DataTypePointer; if (dp != null) { pv.SetDataType(dp); } else { pv.SetDataType(ps[i].ParameterLibType); } pvs.Add(pv); break; } } if (!bFound) { ParameterValue p = owner.CreateDefaultParameterValue(i); pvs.Add(p); } } parameters.Clear(); parameters.AddRange(pvs); }
static public void ValidateParameterValues(ParameterValueCollection parameters, Type[] ps, IActionMethodPointer owner) { List <ParameterValue> pvs = new List <ParameterValue>(); if (ps != null) { for (int i = 0; i < ps.Length; i++) { bool bFound = false; if (i < parameters.Count && parameters[i] != null) { if (parameters[i].ParameterLibType != null) { if (parameters[i].ValueType == EnumValueType.ConstantValue && ps[i].IsAssignableFrom(parameters[i].ParameterLibType)) { bFound = true; parameters[i].SetDataType(ps[i]); pvs.Add(parameters[i]); } else { bFound = true; pvs.Add(parameters[i]); } } } if (!bFound) { ParameterValue p = owner.CreateDefaultParameterValue(i); if (p != null) { pvs.Add(p); } } } } parameters.Clear(); parameters.AddRange(pvs); }