public static IPropertySymbol RemoveAttributeFromParameters( this IPropertySymbol property, INamedTypeSymbol[] attributesToRemove) { if (attributesToRemove == null) { return property; } Func<AttributeData, bool> shouldRemoveAttribute = a => attributesToRemove.Where(attr => attr != null).Any(attr => attr.Equals(a.AttributeClass)); var someParameterHasAttribute = property.Parameters .Any(p => p.GetAttributes().Any(shouldRemoveAttribute)); if (!someParameterHasAttribute) { return property; } return CodeGenerationSymbolFactory.CreatePropertySymbol( property.ContainingType, property.GetAttributes(), property.DeclaredAccessibility, property.GetSymbolModifiers(), property.Type, property.ExplicitInterfaceImplementations.FirstOrDefault(), property.Name, property.Parameters.Select(p => CodeGenerationSymbolFactory.CreateParameterSymbol( p.GetAttributes().Where(a => !shouldRemoveAttribute(a)).ToList(), p.RefKind, p.IsParams, p.Type, p.Name, p.IsOptional, p.HasExplicitDefaultValue, p.HasExplicitDefaultValue ? p.ExplicitDefaultValue : null)).ToList(), property.GetMethod, property.SetMethod, property.IsIndexer); }