TypeName | SA1411AttributeConstructorMustNotUseUnnecessaryParenthesis |
CheckId | SA1411 |
Category | Maintainability Rules |
An attribute declaration does not contain any parameters, yet it still includes parenthesis.
When an attribute declaration does not contain any parameters, the parenthesis around the parameters are optional.
A violation of this rule occurs when unnecessary parenthesis have been used in an attribute constructor. For example:
[Serializable()]
The parenthesis are unnecessary and should be removed:
[Serializable]
Remove the unnecessary parenthesis.
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1411:AttributeConstructorMustNotUseUnnecessaryParenthesis", Justification = "Reviewed.")]
#pragma warning disable SA1411 // AttributeConstructorMustNotUseUnnecessaryParenthesis
#pragma warning restore SA1411 // AttributeConstructorMustNotUseUnnecessaryParenthesis