private static IEnumerable<CustomAttribute> GetInheritedAttributes(MethodDefinition definition, int paramIndex) { bool same = true; foreach (var method in definition.GetInheritanceHierarchy()) { foreach (var attr in method.Parameters[paramIndex].CustomAttributes) { if (same || attr.IsInheritable()) { yield return attr; } } same = false; } }
public static bool IsBaseMethodOf(this MethodDefinition definition, MethodDefinition other) { return other.GetInheritanceHierarchy().Contains(definition); }