A collection of hands-on demonstrations showcasing the latest features in C# 14, with side-by-side comparisons to traditional approaches.
C# 14 introduces powerful new language features that improve code expressiveness, reduce boilerplate, and better align syntax with semantic intent. This repository provides practical, real-world examples of these features to help developers understand not just what changed, but why it matters.
Each demo includes:
- Problem Statement - What limitation existed in previous C# versions
- Solution - How C# 14 addresses it
- Side-by-Side Comparison - Traditional vs. modern approach
- Real-World Examples - Practical usage scenarios
- Detailed Explanations - Why the new way is better
- .NET 10 SDK (or later)
- C# 14 language support
- Any IDE with C# support (Visual Studio 2025+, JetBrains Rider, VS Code)
dotnet --version # Should show 10.x or highergit clone <repository-url>
cd Griffin.CSharp14Demosdotnet build Griffin.CSharp14Demos.slncd Demo_ExtensionMethods
dotnet runLocation: Demo_ExtensionMethods/
What it demonstrates: The evolution from extension methods to extension members, allowing property-like syntax for characteristics instead of forcing method call syntax.
Key Concept:
// Old Way: Extension Method (requires parentheses)
var monday = date.MondayOfCurrentWeek();
// New Way: Extension Member (property syntax)
var monday = date.MondayOfCurrentWeek;Run it:
cd Demo_ExtensionMethods
dotnet run📖 Read the full demo documentation
This repository will be expanded with additional C# 14 feature demonstrations including:
- Params collections
- Field keyword in properties
- Lock object improvements
- And more...
Griffin.CSharp14Demos/
├── Griffin.CSharp14Demos.sln # Solution file
├── README.md # This file
├── CLAUDE.md # AI assistant guidance
│
├── Demo_ExtensionMethods/ # Extension Members demo
│ ├── Demo_ExtensionMethods.csproj
│ ├── Program.cs
│ ├── DateTimeExtensions.cs # Traditional approach
│ ├── DateTimeExtensionMembers.cs # C# 14 approach
│ └── README.md
│
└── [Future Demos]/
Want to add a new C# 14 feature demonstration? Follow this pattern:
- Create a new project folder:
Demo_{FeatureName}/ - Configure for C# 14:
<TargetFramework>net10.0</TargetFramework> <LangVersion>14.0</LangVersion>
- Include both approaches: Show the old way vs. the new C# 14 way
- Add comprehensive README: Explain the problem, solution, and real-world usage
- Create runnable demo:
Program.cswith clear console output - Update this README: Add your demo to the demos list
C# 14 isn't just about new syntax - it's about writing code that says what it means. These demos focus on:
- Semantic Clarity - Code that reads like natural language
- Practical Application - Real-world scenarios, not just toy examples
- Comparative Learning - Understanding why the new way is better
- Educational Value - Teaching through clear, documented examples
This repository is for educational purposes.
Each feature demonstration is designed to be self-contained and runnable. Explore each demo's README for detailed explanations and sample output.