public static void RemoveAttribute(Collection<CustomAttribute> customAttributes, string attributeName) { var attributes = (from attribute in customAttributes where attribute.Constructor.DeclaringType.FullName.Contains(attributeName) select attribute).ToList(); foreach (var attribute in attributes) { customAttributes.Remove(attribute); } } }