public IEnumerable <IAttributeInfo> GetCustomAttributes(string typeName, bool inherit) { var attributes = type.GetCustomAttributes(typeName) .Select(x => x.AsAttributeInfo()); if (!inherit) { return(attributes); } var baseAttributes = GetBaseTypes() .SelectMany(x => x.GetCustomAttributes(typeName, false)); return(attributes.Concat(baseAttributes)); }