params collections, partial properties, System.Threading.Lock and a batch of performance and interop refinements.
This release added 9 features, each with a before-and-after example.
Features in C# 13.0
- Allow params to use collections - The params keyword no longer has to use an array but can use other collection types.
- allows ref struct - Allow ref struct types to be used as generic type arguments.
- Character literal escape sequence - A new
\eescape sequence for character literals. - Implicit index access - Allow the
^from-end operator to be used in object initializers. - Method group natural type improvements - Method groups are now more likely to identify the correct method.
- New lock object - A new disposable System.Threading.Lock type optimized for modern lock statements.
- Overload resolution priority - Allow library authors to guide which overload is preferred using an attribute.
- Partial properties & indexers - Allow properties and indexers to be partially defined like partial methods.
- ref and unsafe in iterators and async - Allow ref locals and unsafe blocks in iterator and async methods.