Skip to content

refactor: use collection expressions and is-null pattern in remaining sites#875

Merged
laurentiu021 merged 1 commit into
mainfrom
refactor/modernization-collection-expr
Jun 12, 2026
Merged

refactor: use collection expressions and is-null pattern in remaining sites#875
laurentiu021 merged 1 commit into
mainfrom
refactor/modernization-collection-expr

Conversation

@laurentiu021

Copy link
Copy Markdown
Owner

Summary

Byte-identical .NET 10 / C# idiom cleanups — the remaining mechanical modernization sites
from the audit. No behavior change.

Changes

  • Collection expressions replacing the older initializer syntax:
    • Models/TargetPreset.csAll = new[] { ... }[ ... ]
    • Services/AppAlertService.cs — uninstall paths new[] { ... }string[] paths = [ ... ]
    • Services/DeepCleanupService.csroots = new List<string> { ... }List<string> roots = [ ... ] (still a mutable List; later .Add() preserved)
    • Services/DuplicateFileService.csnew Dictionary<long, List<FileInfo>>()Dictionary<long, List<FileInfo>> sizeGroups = []
    • Services/FileShredderService.csnew Stack<DirectoryInfo>()Stack<DirectoryInfo> stack = []
    • SysManager.Tests/EventLogServiceTests.csnew List<EventSeverity> { ... }[ ... ]
  • Pattern matching: Helpers/EqualityConverter.csvalue == null || parameter == null
    value is null || parameter is null.

Not converted (deliberately)

  • Models/ContextMenuPreset.cs dictionary-with-indexer-initializer — collection expressions
    don't cleanly express keyed dictionary initializers, so it's left as new Dictionary<...>{ [k]=v }.

Verification

  • Build: main + Tests 0 warnings / 0 errors (clean --no-incremental rebuild).
  • Every change is byte-identical in behavior (same collection contents / same null check).

refactor: → no release.

@laurentiu021 laurentiu021 merged commit 82ec7c0 into main Jun 12, 2026
4 checks passed
@laurentiu021 laurentiu021 deleted the refactor/modernization-collection-expr branch June 12, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant