static bool IsHiding (MethodDefinition method, TypeReference type) { if (type == null) return false; TypeDefinition td = type.Resolve (); if ((td != null) && td.HasMethods) { string name = method.Name; foreach (MethodDefinition md in td.Methods) { if (!md.IsPublic && !md.IsFamily) continue; if (name != md.Name) continue; if (method.CompareSignature (md)) return true; } } return IsHiding (method, type.DeclaringType); }
static bool IsSignatureDictatedByInterface (MethodDefinition method, TypeReference type) { if (type == null) return false; TypeDefinition td = type.Resolve (); if (td == null) return false; foreach (TypeReference intf_ref in td.Interfaces) { TypeDefinition intr = intf_ref.Resolve (); if (intr == null) continue; if (intr.HasMethods) { foreach (MethodDefinition md in intr.Methods) { if (method.CompareSignature (md)) return true; } } // check if the interface inherits from another interface with this signature if (IsSignatureDictatedByInterface (method, intr.BaseType)) return true; } // check if a base type is implementing an interface with this signature return IsSignatureDictatedByInterface (method, td.BaseType); }