Skip to content

Add lightweight C# 12 refactoring sample - #15

Merged
balajibashyam merged 5 commits into
mainfrom
feature/csharp-12-refactoring-sample
Aug 4, 2026
Merged

Add lightweight C# 12 refactoring sample#15
balajibashyam merged 5 commits into
mainfrom
feature/csharp-12-refactoring-sample

Conversation

@balajibashyam

Copy link
Copy Markdown
Contributor

Summary

Adds a minimal .NET 10 console companion for the C# 12 Language Features: Primary Constructors, Collections & More tutorial.

What's included

  • New sample: csharp-language/csharp-12-features/ — 9 files

    • TodoItem with class primary constructor, explicit properties, title normalization
    • TodoService with service primary constructor, collection expressions, spread elements, tuple-type alias
    • TodoFormatter with default lambda parameter
    • Deterministic console output with 5 exact expected lines
    • 7 unit tests covering properties, reflection isolation, seed/snapshot copying, spread immutability, tuple counts, lambda defaults, and active filtering
  • Root README: New sample row in the table + csharp-language/ tree section

  • GitHub Actions: New test-csharp-12-features job with LangVersion verification and console-output checks

Deliberately omitted (stays in the full tutorial)

  • Inline arrays, stack allocation, unsafe code
  • Benchmarks, allocation claims
  • Minimal APIs, ASP.NET Core
  • C# 11 list patterns, preview features

Versions

  • .NET SDK: 10.0.302
  • LangVersion: 12.0 (both projects, explicitly pinned)
  • Application packages: none
  • xunit.v3: 3.2.2

Validation

  • dotnet restore — passed
  • dotnet build --configuration Release — passed (0 errors, 0 warnings, TreatWarningsAsErrors)
  • dotnet test --configuration Release — passed (7/7)
  • dotnet msbuild -getProperty:LangVersion — 12.0 (app + test)
  • Console output — matches expected exactly
  • Security scan — clean

@balajibashyam
balajibashyam merged commit 673f498 into main Aug 4, 2026
17 checks passed
@balajibashyam
balajibashyam deleted the feature/csharp-12-refactoring-sample branch August 4, 2026 16:24
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