public static Indexers GetIndexersForType (Type caller_type, Type lookup_type) { Indexers ix = new Indexers (); if (TypeManager.IsGenericParameter (lookup_type)) { GenericConstraints gc = TypeManager.GetTypeParameterConstraints (lookup_type); if (gc == null) return ix; if (gc.HasClassConstraint) { Type class_contraint = gc.ClassConstraint; while (class_contraint != TypeManager.object_type && class_contraint != null) { ix.Append (caller_type, GetIndexersForTypeOrInterface (caller_type, class_contraint)); class_contraint = class_contraint.BaseType; } } Type[] ifaces = gc.InterfaceConstraints; foreach (Type itype in ifaces) ix.Append (caller_type, GetIndexersForTypeOrInterface (caller_type, itype)); return ix; } Type copy = lookup_type; while (copy != TypeManager.object_type && copy != null){ ix.Append (caller_type, GetIndexersForTypeOrInterface (caller_type, copy)); copy = copy.BaseType; } if (lookup_type.IsInterface) { Type [] ifaces = TypeManager.GetInterfaces (lookup_type); if (ifaces != null) { foreach (Type itype in ifaces) ix.Append (caller_type, GetIndexersForTypeOrInterface (caller_type, itype)); } } return ix; }