SA1313: Parameter '__' must begin with lower-case letter.
See original GitHub issueThe following code snippet is OK in StyleCop 4.6, but not in StyleCopAnalyzers:
Action<object, object> b = (_, __) => { };
The warning output is warning SA1313: Parameter '__' must begin with lower-case letter
.
StyleCopAnalyzers seems to be OK with a single underscore, but not two underscores. I assume this is due to https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/StyleCop.Analyzers/StyleCop.Analyzers/NamingRules/SA1313ParameterNamesMustBeginWithLowerCaseLetter.cs#L86 explicitly checking for a single underscore.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:22 (11 by maintainers)
Top Results From Across the Web
StyleCopAnalyzers/documentation/SA1313.md at master
The name of a parameter in C# does not begin with a lower-case letter. Rule description. A violation of this rule occurs when...
Read more >stylecop - StyleCopAnalyzers/SA1313 in a positional record
As properties, these elements should be capitalized, but if I do it, SA1313 complains: Parameter '__' must begin with lower-case letter.
Read more >Top StyleCop Coding Styles Part 3
SA1113 Comma Must Be on Same Line as Previous Parameter. CORRECT. INCORRECT ... SA1313 Parameter Names Must Begin with Lower Case Letter. CORRECT....
Read more >The dotnet format command and StyleCop.Analyzers
Variable names should begin with lower-case letter --> <Rule Id="SA1313" Action="Warning" /> <!-- Parameter names should begin with ...
Read more >https://raw.githubusercontent.com/dotnet/runtime/8...
Variable should begin with lower-case letter --> <Rule Id="SA1313" Action="None" /> <!-- Parameter should begin with lower-case letter --> <Rule Id="SA1314" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To add my two cents to this.
WPF has a very common type
RoutedEventHandler
so seeing(_,__) => {...}
when responding to events is rather normal.While it would be better if C# supported
_
as a syntax for ignored parameters (like other languages). Using multiple underscore to communicate parameters as being unused is still better than using comments to communicate unuse. It also falls into line with alot of the teaching out there for functional programming.The stable 1.1.118 fixes this, and is making my code better in new ways.