-
Notifications
You must be signed in to change notification settings - Fork 23
SA1410
ptittof57 edited this page Aug 15, 2015
·
5 revisions
<title>SA1410: RemoveDelegateParenthesisWhenPossible</title>
<script src="script/helpstudio.js" type="text/javascript"></script>
<script src="script/StandardText.js" type="text/jscript"></script>
<script type="text/jscript">WritePageTop(document.title);</script>
TypeName |
RemoveDelegateParenthesisWhenPossible |
CheckId |
SA1410 |
Category |
Maintainability Rules |
A call to a C# anonymous method does not contain any method parameters, yet the statement still includes parenthesis.
When an anonymous method does not contain any method parameters, the parenthesis around the parameters are optional.
A violation of this rule occurs when the parenthesis are present on an anonymous method call which takes no method parameters. For example:
this.Method(delegate() { return 2; });
The parenthesis are unnecessary and should be removed:
this.Method(delegate { return 2; });
Remove the unnecessary parenthesis after the delegate keyword.
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1410:RemoveDelegateParenthesisWhenPossible", Justification = "Reviewed.")]
- - SA0102 - Clean Install
- - Download
- - Documentation Rules - Layout Rules - Maintainability Rules - Naming Rules - Ordering Rules - Readability Rules - Spacing Rules - Suppressions
- - Adding a custom StyleCop settings page - Adding custom rule settings - Authoring a custom styleCop rule - Authoring rules metadata - Custom CSharp Language Service - Custom MSBuild Integration - Hosting StyleCop in a Custom Environment - Installing a Custom Rule - Integrating StyleCop Into Build Environments - Integrating StyleCop into MSBuild - Writing Custom Rules for StyleCop