Every single feature added in C# 11

preview_player
Показать описание
Until the 28th of Nov 2022 use discount code BF2022 for up to 25% off

Hello everybody I'm Nick and in this video I will introduce you to every single feature added in C# 11.

Timestamps
Raw string literals - 0:00
List patterns - 5:04
Generics on attributes - 7:41
Extended nameof scope - 9:11
UTF-8 string literals - 10:08
String interpolated new line - 12:29
Generic maths/abstracting over static members - 13:23
Required members - 16:14
File scoped types - 17:45
Pattern matching on Spans for constant strings - 19:47
Auto-default structs - 20:57
Improved method group conversion to delegate - 21:51
Numeric IntPtr - 22:52
ref fields and ref scoped variables - 23:34

Don't forget to comment, like and subscribe :)

Social Media:

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

My god, I can't even imagine how people even _compare_ java to this language. C# is on an entirely different level. There are things in C#11 where the developers of java don't even know what they are.
My boss absolutely loves Java and it's so frustrating. We don't have access to generics (T.class, instanceof, new, etc), no operator overloading, no extension methods, no namespaces, no value types, everything has to be boxed, all function calls are virtual, it doesn't compile to actual machine code, there are no properties, no pattern matching, no nameof, no spans, no linq query syntax, no async/await, no generator functions, no partial classes, records were an afterthought that don't really help anything, reflection is half as powerful, no assembly-level visibility, no linq expression tree compilation, I could go on for hours.

string interpolation, better string literals, dynamic type (for easier reflection), multiple generic classes with the same name but different generic count, no tuples, no named tuples, no initialization statements, no references, no top level main function, functions aren't first-class members, no local functions, just one class per file,

barmetler
Автор

You missed one interesting feature: you can now declare ref fields inside a ref struct. So you can write a new type like Span<T> etc

Integer
Автор

I have purchased courses from both Nick Chapsas and Tim Corey and Nick's courses are head and shoulders above Tim's. Nick talks at normal speed in his courses, provides the source code to follow along, and goes deep into the technical details of the topic. The courses are priced the same as a good book. They are a great value. Looking forward to more courses. I'd love a course on CI/CD with Azure and good NuGet package making practices.

umilmi
Автор

static abstract interface members are my favorite by far. I cannot count how many times I thought "this code would be much nicer if this was possible".

Second is raw string literals, because I have tons of tests that need constant XML or JSON values.

dlhsnbrn
Автор

Generics on attributes and required members are what I am personally looking forward to.

I can write cleaner OO code that end users are less likely to be able to misuse :)

NicholasReaves
Автор

This video was an impressive introduction to a lot of new features, most of this really wanted for the community. Amazing video, thanks you for sharing.

olivervalienteoliva
Автор

My favorite new feature is the required' keyword with the new raw string literals as a close second. As someone who doesn't really write library/package code, only front-end consumed code, the other features don't really apply; but I love the work that the C# design team has done!

justinian.erdmier
Автор

This video is truly awesome. The perfect amount of detail to understand what the features do without making it way too long.

foamtoaster
Автор

I was really hoping that the `required` keyword had more use cases. I was thinking it'd be awesome if DI could use them for property injection- if the field is specified as `required`, then when the DI container tries to build the type, it should try to populate those values and throw if it doesn't have a registration for it. This would mean we could get rid of constructor injection which would be awesome!

DevonLehmanJ
Автор

I really do love list patterns for parsers, a very useful feature

diadetediotedio
Автор

Scoped (and ref fields), easily. A big addition to the ref/ref readonly/in parameter toolkit.

RaistlanCE
Автор

The "required" keyword seems to be the most benefitial and to be used. Tx.

meirkr
Автор

I'm disappointed that semi-auto properties were not added in C#11 :( that was the feature I was looking forward to most

HimmDawg
Автор

ref fields and ref scoped are my favourites!

TOMRUS
Автор

21:30 The reason you need to initialize all values first is because structs are always located linearly in memory, and are not reset by default (as this has a performance cost), so C# gives you the opportunity to either use them without initialization default (and save a few nanoseconds, which can be relevant in extremely performance-hungry code), or initialize them all to ensure consistency

diadetediotedio
Автор

Awesome content. So useful. Any chance you can do similar summaries for earlier versions for those catching up? I find it incredibly useful in keeping up to date.

Thanks again for such great content. 😎

robertcahoon
Автор

This one video is worth so much for people who want to move to c# 11
Thx a lot man, you helped me more then you can believe 😄

nilscoussement
Автор

Thanks for great video. My favourite features are list patterns, required member and pattern machining on spans...

nandkishorsonwale
Автор

Thank you for the videos. I found out about you a few weeks ago and since then I am watching all of your videos and enjoy them very much!

buysmartter
Автор

This video is so useful as usual. A similar video demonstrating all new features of C#9, 10, etc. Would also be very useful. I can see that you like to focus on new features, but you would be surprised how many teams still use. NET all the way back to 4.0. Even Microsoft is still moving code from ancient releases.
These many folks could use a series of such videos as a single point of reference as they transition.

CharlesBurnsPrime