+
+ Type [] types = new Type [pi.Length];
+ IParameterData [] par = new IParameterData [pi.Length];
+ bool is_params = false;
+ for (int i = 0; i < types.Length; i++) {
+ types [i] = TypeManager.TypeToCoreType (pi [i].ParameterType);
+
+ ParameterInfo p = pi [i];
+ Parameter.Modifier mod = 0;
+ if (types [i].IsByRef) {
+ if ((p.Attributes & (ParameterAttributes.Out | ParameterAttributes.In)) == ParameterAttributes.Out)
+ mod = Parameter.Modifier.OUT;
+ else
+ mod = Parameter.Modifier.REF;
+
+ //
+ // Strip reference wrapping
+ //
+ types [i] = TypeManager.GetElementType (types [i]);
+ } else if (i == 0 && TypeManager.extension_attribute_type != null && method != null && method.IsStatic &&
+ (method.DeclaringType.Attributes & Class.StaticClassAttribute) == Class.StaticClassAttribute &&
+ method.IsDefined (TypeManager.extension_attribute_type, false)) {
+ mod = Parameter.Modifier.This;
+ } else if (i >= pi.Length - 2 && types [i].IsArray) {
+ if (p.IsDefined (TypeManager.param_array_type, false)) {
+ mod = Parameter.Modifier.PARAMS;
+ is_params = true;
+ }
+ }
+
+ par [i] = new ParameterData (p.Name, mod);
+ }
+
+ return method != null ?
+ new ParametersCollection (par, types, method, is_params) :
+ new ParametersCollection (par, types);