C# 13 Unleashed: Live Demos of my Top 10 Cutting-Edge Features!
What if `params` wasn't limited to arrays? See this and nine other game-changing features coming in C# 13.
#1about 3 minutes
A brief history of C# from version 1 to 12
Key features like generics, LINQ, async/await, and records were introduced in major C# versions leading up to C# 13.
#2about 1 minute
How to set up your environment for C# 13
To use C# 13 features, you must install the .NET 9 SDK and use a recent preview version of Visual Studio 2022.
#3about 3 minutes
Using the enhanced params modifier with collections
The `params` modifier in C# 13 is no longer limited to arrays and can now be used with any collection type, including `ReadOnlySpan` or custom types.
#4about 2 minutes
Using the caret operator in object initializers
The caret operator (`^`) can now be used within object initializers to set collection elements from the end, simplifying code for tasks like countdowns.
#5about 3 minutes
Simplifying terminal output with the new escape sequence
C# 13 introduces the `\e` escape sequence as a more intuitive and less error-prone way to represent the escape character for terminal and console applications.
#6about 3 minutes
Separating definitions with partial properties and indexers
Partial properties and indexers allow you to split a property's declaration from its implementation across different parts of a partial class, which is useful for source generators.
#7about 6 minutes
Guiding overload resolution with a priority attribute
The `OverloadResolutionPriority` attribute allows library authors to guide the compiler in choosing a specific method overload, resolving ambiguities without breaking changes.
#8about 3 minutes
Improving thread synchronization with the new lock type
A new `System.Threading.Lock` type provides a more efficient and clearer way to handle thread synchronization in multi-threaded applications compared to traditional locking mechanisms.
#9about 4 minutes
Optimizing method group overload resolution
The compiler now handles method groups more efficiently by eliminating non-matching method candidates earlier in the process, improving performance in complex overload scenarios.
#10about 3 minutes
Using ref and unsafe contexts in async methods
C# 13 allows the use of `ref` local variables and `unsafe` contexts within async methods and iterators, with restrictions around `await` and `yield` boundaries to ensure safety.
#11about 2 minutes
Allowing ref struct types in generic parameters
You can now use `ref struct` types as generic type parameters by using the `allow-ref-struct` constraint, enabling more efficient generic algorithms.
#12about 3 minutes
Implementing interfaces with ref struct types
`ref struct` types can now implement interfaces, combining the performance benefits of `ref struct` with the abstraction provided by interfaces, though conversion to the interface type is restricted.
Related jobs
Jobs that call for the skills explored in this talk.
WeAreDevelopers LIVE days are changing - get ready to take partStarting with this week's Web Dev Day edition of WeAreDevelopers LIVE Days, we changed the the way we run these online conferences. The main differences are:Shorter talks (half an hour tops)More interaction in Q&AA tips and tricks "Did you know" sect...