chore(sonar): apply collection-expression syntax across all sites (IDE0028)
SonarQube Analysis / sonarqube (pull_request) Successful in 2m47s

Manual sweep of all 42 IDE0028 sites flagged by SonarQube — `dotnet format
analyzers --diagnostics IDE0028` declined to fix these (no .editorconfig
opt-in for `dotnet_style_prefer_collection_expression`), so applied by
hand. The repo already targets `<LangVersion>latest</LangVersion>` on
net8.0, so C# 12 collection expressions are available.

Pattern: `new List<T>()` / `new Dictionary<K,V>()` / `new ArrayList()` /
`new()` -> `[]` for empty; `new List<T> { ... }` -> `[...]` for literal.

24 files touched in src/{EFCore, LinqToSql, Query, Snowflake, SqlBreakdown,
SqlServer}; tests untouched (no IDE0028 sites in test code).

Build clean (35 warnings unchanged from baseline, 0 errors). All tests
remain green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thom Lamb
2026-05-26 17:01:30 -05:00
co-authored by Claude Opus 4.7
parent c38d122d76
commit 0f8d505616
24 changed files with 46 additions and 46 deletions
@@ -41,8 +41,8 @@ public class QueryBreakdown : SqlBreakdownBase, IQueryBreakdown
public QueryBreakdown() : base()
{
Parser = new StatementParser();
_parameterList = new List<IQueryParam>();
_withClauses = new List<IWithClause>();
_parameterList = [];
_withClauses = [];
// Initialize backing fields directly to avoid triggering cache invalidation
_selectClause = new SqlExpressionClause(splitOnComma: true);
@@ -117,7 +117,7 @@ public class QueryBreakdown : SqlBreakdownBase, IQueryBreakdown
/// Gets the parameter dictionary containing parameter names and their values.
/// Parameter values can be set/updated after parsing.
/// </summary>
public Dictionary<string, object> Parameters { get; } = new Dictionary<string, object>();
public Dictionary<string, object> Parameters { get; } = [];
/// <summary>
/// Gets the WITH clauses (Common Table Expressions) as an ordered list.