public class ReflectionParameters : ParameterData {
ParameterInfo [] pi;
- Type[] type_params;
bool last_arg_is_params = false;
bool is_varargs = false;
ParameterData gpd;
return;
}
- if (mb.IsGenericMethodDefinition)
- type_params = mb.GetGenericArguments ();
-
attrs = pi [count].GetCustomAttributes (TypeManager.param_array_type, true);
if (attrs == null)
return;
if (gpd != null)
return gpd.GenericConstraints (pos);
- if (type_params == null)
+ Type t = ParameterType (pos);
+ if (!t.IsGenericParameter)
return null;
- return ReflectionConstraints.Create (type_params [pos]);
+ return ReflectionConstraints.Create (t);
}
public string ParameterName (int pos)
int count;
public readonly Parameters Parameters;
- public readonly TypeParameter[] TypeParameters;
public InternalParameters (Type [] param_types, Parameters parameters)
{
count = param_types.Length;
}
- public InternalParameters (DeclSpace ds, Parameters parameters,
- TypeParameter [] type_params)
- : this (ds, parameters)
- {
- this.TypeParameters = type_params;
- }
-
public int Count {
get {
return has_varargs ? count + 1 : count;
public GenericConstraints GenericConstraints (int pos)
{
- if (TypeParameters == null)
+ if (param_types == null)
return null;
- return TypeParameters [pos].Constraints;
+ return GetParameter (pos).GenericConstraints;
}
public string ParameterName (int pos)
}
}
+ //
+ // Compares member infos based on their name and
+ // also allows one argument to be a string
+ //
+ class MemberInfoCompare : IComparer {
+
+ public int Compare (object a, object b)
+ {
+ if (a == null || b == null){
+ Console.WriteLine ("Invalid information passed");
+ throw new Exception ();
+ }
+
+ if (a is string)
+ return String.Compare ((string) a, ((MemberInfo)b).Name, false, CultureInfo.InvariantCulture);
+
+ if (b is string)
+ return String.Compare (((MemberInfo)a).Name, (string) b, false, CultureInfo.InvariantCulture);
+
+ return String.Compare (((MemberInfo)a).Name, ((MemberInfo)b).Name, false, CultureInfo.InvariantCulture);
+ }
+ }
+
struct Pair {
public object First;
public object Second;