Open sandboxFocus

Class SuppressWarningAttribute

Instructs PostSharp to ignore warnings and information messages. Errors cannot be ignored.

Inheritance
SuppressWarningAttribute
Namespace: PostSharp.Extensibility
Assembly: PostSharp.dll
Syntax
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
public class SuppressWarningAttribute : Attribute
Remarks

Apply this attribute to the element of code that causes the warning, or to any enclosing declaration, such as the declaring type or the assembly, to suppress the warning for all the elements it contains. It works with any PostSharp warning, including warnings emitted by aspects and constraints with Message or MessageSource. PostSharp looks for the attribute starting from the MessageLocation of the message, so it cannot suppress a message emitted without a location. The message identifier is compared without regard to case.

To ignore a warning in the whole project, or to escalate warnings into errors, use the project settings instead.

Constructors

Name Description
SuppressWarningAttribute(string)

Initializes a new instance of the SuppressWarningAttribute class.

Properties

Name Description
MessageId

Gets the identifier of the ignored warning.

Reason

Gets or sets the reason (a human-readable text) why the warning must be ignored.

See Also