Open sandboxFocus

Method RemoveAttributes

RemoveAttributes(IAdviser<IDeclaration>, INamedType)

Removes all custom attributes of a given INamedType from a given declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to remove attributes from a different declaration than the current one.

Declaration
public static IRemoveAttributesAdviceResult RemoveAttributes(this IAdviser<IDeclaration> adviser, INamedType attributeType)
Parameters
Type Name Description
IAdviser<IDeclaration> adviser

An adviser for a declaration.

INamedType attributeType

The type of custom attributes to be removed. All attributes whose type is assignable to this type will be removed.

Returns
Type Description
IRemoveAttributesAdviceResult

An IRemoveAttributesAdviceResult exposing the removal operation.

Remarks

Note that custom attributes cannot be edited in place. To modify an attribute, remove it using this method and add a new one using IntroduceAttribute(IAdviser<IDeclaration>, IAttributeData, OverrideStrategy).

See Also

RemoveAttributes(IAdviser<IDeclaration>, Type)

Removes all custom attributes of a given Type from a given declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to remove attributes from a different declaration than the current one.

Declaration
public static IRemoveAttributesAdviceResult RemoveAttributes(this IAdviser<IDeclaration> adviser, Type attributeType)
Parameters
Type Name Description
IAdviser<IDeclaration> adviser

An adviser for a declaration.

Type attributeType

The type of custom attributes to be removed. All attributes whose type is assignable to this type will be removed.

Returns
Type Description
IRemoveAttributesAdviceResult

An IRemoveAttributesAdviceResult exposing the removal operation.

Remarks

Note that custom attributes cannot be edited in place. To modify an attribute, remove it using this method and add a new one using IntroduceAttribute(IAdviser<IDeclaration>, IAttributeData, OverrideStrategy).

See Also