no-empty-delegate-parens
What it does
Section titled “What it does”Reports an anonymous method with an empty parameter list: delegate() { } is delegate { }. Parentheses with a comment in them are not reported. The fix is unsafe: without a parameter list the method also converts to delegate types that have parameters, which can change which overload is chosen.
Why it matters
Section titled “Why it matters”delegate { } is the shorter spelling of the same body, and the empty parentheses add nothing to read. They are not always the same to the compiler: the form without a list also converts to delegate types that have parameters, which can change which overload is chosen, and that is why the fix is unsafe.
Example
Section titled “Example”... [A, // why... int x; Action a = delegate() { };}Configuration
Section titled “Configuration”csharp: lint: rules: no-empty-delegate-parens: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line no-empty-delegate-parens in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| StyleCop | SA1410 |
full |