C#'s Best features you might not be using

preview_player
Показать описание
Take a look at some great C# features that can make your code more resilient and easier to understand. This talk will help you improve the code your team writes right away because all of these features are available in C# 12, with many available in lower versions. You'll leave knowing not only what makes better code but why.

Connect with .NET:

#dotnet
Рекомендации по теме
Комментарии
Автор

Another feature that I think few people use: value tuples & tuple destructuring assignments. Especially with async methods, where you can't use out parameters, it's super comfortable to return and assign multiple values. (I always find it odd how many developers seem to hate tuples, and they'd rather define a pointless class or struct just to be able to return multiple pieces of data from a single method)

leakyabstraction
Автор

I think that the backwards compatibility is getting a bit excessive, and it would be a good idea to "purge" every once in a while to avoid having a system that carries your 20 years old mistakes and now-obsolete approaches. I don't think everything can be handled in a purely additive fashion, and as the options to do the exact same thing grow, it gets more and more confusing, especially for new developers. But of course I do love C#, and I appreciate the innovations which were introduced - my biggest real issue with the language is actually that the type system feels extremely rigid these days. As another commented mentioned, we'd arguably really need discriminated unions. I personally also really miss the literal types that I use in TypeScript - it feels like C# is not just rigid, but also lacks expressive power and precision with that "a string is a string is a string" behavior. And if you want to avoid primitive obsession, it's always an overhead, even in the simplest cases.

leakyabstraction
Автор

All C# really needs is discriminated unions. F# type system is as good as Rust one. If C# had F# type system while still being C# it would be perfect... I like F# but I hate lack of { and } that makes code so much harder to track... I'm not a fan of trying to make everything backward compatible because it leads to weird design decisions and it doesn't leave much room for innovation - making the language feel "outdated". Would be cool if M$ actually created new language that is compatible with .NET ecosystem and takes all the best from Rust, F#, C#, Kotlin

konrad
Автор

Fine to resume all these new features, Thanks

olivier
Автор

File scoped namespaces : One more thing that has been around in VB since forever.

jem
Автор

C #이 언어 사양으로 개발되지 않기를 바랍니다.
그리고 golang과 같은 플랫폼 멀티 플랫폼에 더 중점을 두었으면 좋겠습니다.
그리고 성능에 더 중점을 두어야 합니다.
Windows와 같은 운영 체제에 의존하는 언어는 지금 미래가 없습니다.

hobisb
Автор

Here is some features you might not be using : DARK MODE

mohammedalsaedi
Автор

10:50 if Microsoft cared about how much horizontal space we have for code, they'd do something about the ludicrous number of margins for indicators, code folding and other junk to the left of the VS editor window.

rich_in_paradise
Автор

I really wish they'd:
(a) Stop trying to turn C# into JavaScript,
(b) Stop overloading every keyword into the ground,
(c) Stop making C# as unreadable and cryptic as possible,
(d) Stop trying to make C# overly terse... really, you type it once and the IDE helps you type it in most cases.

TheoWerewolf