Skip to content

Replace casts with pattern matching for performance and readability - #890

Merged
304NotModified merged 2 commits into
masterfrom
replace-cast-with-pattern-matching
Nov 10, 2026
Merged

304NotModified merged 2 commits into
masterfrom
replace-cast-with-pattern-matching

Conversation

@304NotModified

@304NotModified 304NotModified commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Easier to read, shorter and better performance

Fixes

{D274B6EB-CA22-4C9C-9BE6-8035D9F88FA1}

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.94%. Comparing base (e1bde4c) to head (0c992e8).

Files with missing lines Patch % Lines
src/NLog.Extensions.Logging/Logging/NLogLogger.cs 73.33% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #890      +/-   ##
==========================================
+ Coverage   75.70%   75.94%   +0.24%     
==========================================
  Files          23       23              
  Lines        1457     1455       -2     
  Branches      430      430              
==========================================
+ Hits         1103     1105       +2     
+ Misses        173      169       -4     
  Partials      181      181              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@304NotModified
304NotModified marked this pull request as ready for review November 9, 2026 17:05
@304NotModified 304NotModified added this to the 6.3.0 milestone Nov 10, 2026
@304NotModified 304NotModified changed the title Replace cast with pattern matching Replace casts with pattern matching for performance and readability Nov 10, 2026
@304NotModified

Copy link
Copy Markdown
Member Author

I will test this with .NET 11 also, currently installing

@304NotModified

Copy link
Copy Markdown
Member Author

Unfortunately .NET 11 isn't supported by BenchmarkDotNet yey

The new results, with also .NET 9:

Image

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址