Last updated: October 5, 2026
Every C# language article on this site in one place: what changed in recent versions, the core features you use daily, writing fast code, design patterns, testing, and writing secure code. Posts marked tested on .NET 10 were rewritten from a working project, with real compiler errors, output and measurements.
Hit one of these? Start here
| You see this | Read this |
|---|---|
CS0131 on new int[5] { [^1] = 1 }, or not sure which C# 13/14 feature needs which .NET version | C# 13 and C# 14 features |
params ReadOnlySpan<T> and an existing array picking different overloads | C# 13: params collections, measured |
CS0150 when the column width in {value,width} is a variable | String interpolation and alignment |
Two SaveChanges calls and half the data written after a failure | Repository and Unit of Work with EF Core |
| Visual Studio suggests IDE0290 Use primary constructor and you are not sure it is safe | Primary constructors explained |
1. What's new in C#
- C# 13 and C# 14 features: params collections with measured allocations, the new Lock type benchmarked, partial properties, the field keyword and what C# 14 added on .NET 10. (rewritten and tested on .NET 10)
- Primary constructors: how the parameters are captured, classes vs records, and the pitfalls before you accept IDE0290 everywhere.
- Pattern matching: type, property and list patterns, switch expressions and when guards.
- Nullable reference types: enabling them, reading the warnings, the nullable attributes and migrating an existing codebase.
- Records vs classes vs structs: value vs reference semantics and a decision cheat sheet.
- Extension methods: writing them well, real examples, and extension members in C# 14.
2. Core language
- Generics: generic classes and methods, constraints and real-world uses.
- Delegates, events, Func and Action: from a delegate type to events with EventHandler<T>, and the closure trap in loops.
- Interface vs abstract class: the real differences, default interface methods and when to pick each.
- Async/await: how it works underneath, concurrent calls, and the common mistakes.
- Exception handling: custom exceptions, logging them properly, and exceptions vs the Result pattern.
- LINQ: Where, Select, OrderBy, GroupBy and aggregates on everyday data.
- Access modifiers: public, private, protected, internal and protected internal in one short reference.
3. Strings, collections and performance
Measure before you optimise; the profiling guide shows how.
- String interpolation and StringBuilder: interpolation, alignment and padding, and when concatenation becomes a performance problem. (rewritten and tested on .NET 10)
- List vs Dictionary vs HashSet: Big-O cheat sheet, a benchmark and a quick decision guide.
- Frozen collections: FrozenDictionary and FrozenSet vs immutable and read-only collections.
- Span<T> and Memory<T>: zero-allocation code and measuring it with BenchmarkDotNet.
- Source generators: the compilation pipeline, a first generator, debugging and testing it.
- Profiling with dotTrace and PerfView: finding the real bottleneck in a slow program before changing code.
4. Design and architecture
- SOLID principles: each principle with a C# example, plus interview-style quick answers.
- Design patterns: factory, singleton, observer and strategy, and how to choose.
- Dependency injection: constructor injection, scoped vs transient vs singleton, and keyed services.
- Repository pattern: basic and generic repositories, DI registration and testing.
- Repository and Unit of Work with EF Core: seven runs against a real database showing what one SaveChanges does and does not protect. (rewritten and tested on .NET 10)
- Domain-driven design: entities, value objects, aggregates and domain events.
- Event-driven architecture: from C# events to MediatR domain events to integration events between services.
5. Testing and team practice
- TDD with xUnit and Moq: red-green-refactor on an order service and isolating dependencies with Moq.
- Code review checklist: what to look for in a C# pull request and a one-page checklist.
- Git for .NET teams: trunk-based branching, commits and pull requests that stay reviewable.
6. Writing secure C#
- SQL injection prevention: parameterised ADO.NET, EF Core raw SQL done safely and stored procedures.
- Hash passwords: PBKDF2, ASP.NET Core Identity's PasswordHasher and bcrypt, and why SHA-256 is the wrong tool.
- Encryption: AES, RSA and hashing: symmetric vs asymmetric encryption and hashing for integrity.
7. C# beyond the backend
- .NET MAUI: a first cross-platform app with XAML, MVVM and API calls.
- C# for Unity: how Unity C# differs, events and time, the fake-null trap and performance.
Related guides
Building web APIs with these features? The ASP.NET Core tutorials guide covers APIs, security, observability and deployment.
Comments
Post a Comment