| Property | Value |
|---|---|
| Package | Philips.CodeAnalysis.MaintainabilityAnalyzers |
| Diagnostic ID | PH2104 |
| Category | Readability |
| Analyzer | EveryLinqStatementOnSeparateLineAnalyzer |
| CodeFix | Yes |
| Severity | Error |
| Enabled By Default | Yes |
Avoid putting multiple LINQ statements on a single line, as it makes them hard to read.
Spread them over multiple lines. This is what the Code fixer does.
Code that triggers a diagnostic:
class BadExample {
public int BadMethod() {
return list.Where(i => i != 1).Select(t => t.ToString());
}
}And the replacement code:
class GoodExample {
public int GoodMethod() {
return list
.Where(i => i != 1)
.Select(t => t.ToString());
}
}This analyzer does not offer any special configuration. The general ways of suppressing diagnostics apply.