C# 10

Copper Contributor
What's your favorite addition to C# in version 10?
22 Replies

Constant interpolated strings 🙂

New pattern matching and lambda magic. I often create pipelines with DataFlow or Channels. To make such code read more like a script, eg `FromSource.Map(MappingFunction).Lookup(....).WriteToSql(...);` I created some extension methods too hide the boilerplate code for generating blocks/channels, connecting them to the pipeline and handling errors. I tried to use a railway-oriented programming style as much as possible. Unfortunately, I had to do quite a lot of explicit casting to `Func<...>` which made the extension methods a lot harder to write and use than I liked. The one feature I still miss is discriminated unions and the corresponding pattern matching. That would make railway-oriented Result handling a lot cleaner and easier
I am a fan of global usings! Paired with implicit usings and scopped namespaces my files are so minimal and clean!
Extended property patterns are neat. Always great to have more ways to write something.
extended property is my favorite feature
Same here!
Extended Property and Global Using are awesome!
Global usings looks really good. It's nice to remove one level of nesting from your code.
I really like the Records and how they reduce the code. But sometimes I forgot that it exists
yes, exactly.
Preview Features in C#10 (Actually 11):
Static Abstract Interface Members
I believe it would lead to algebraic type system.
Global usings, this is a game changer. Those already working on the Razor know the value of this feature.
Extend method for static class instead of partial class
I have already been using pattern matching in other languages and I love that I can now do it in C# too.

Exactly..! I am also using pattern matching in multiple languages I just love it... Now i am doing it C# too... Its neat and great as always...

I would say, I like the Extended property patterns. It opens up new ways to write C... Anyway, I am loving it.

File-scoped namespace declaration.

Notable addition to C# 10 is file-scoped namespaces, which allows developers to define namespaces at the file level rather than at the project level.

@Eduard Keilholz 

I like the Async Await Enhancements feature in C# 10 that uses enhancement to make it easier to write asynchronous code that is readable and awesome.