What's New in C# 12 | .NET Conf 2023

  Рет қаралды 54,804

dotnet

dotnet

Күн бұрын

A new .NET means a new C#! Dustin and Mads will take you through the new features in C# 12, including collection expressions and primary constructors.
Chapters:
00:00 Welcome
00:06 What's New in C# 12
00:45 Get started and connect
aka.ms/learn-dotnet-8
02:05 New Features Demo
35:24 Wrap
Resource links:
github.com/DustinCampbell/CSh...
github.com/dotnet/roslyn/blob...
github.com/dotnet/csharplang
learn.microsoft.com/dotnet/cs...
Download .NET 8 - aka.ms/get-dotnet-8
Hack Together - aka.ms/hacktogether/dotnet
Learn collection - aka.ms/learn-dotnet-8
.NET 8 Survey - aka.ms/dotnet-survey
Local Events - aka.ms/dotnetconf-local-event
Hero blog - aka.ms/dotnet8blog
Blog: aka.ms/dotnet/blog
Twitter: aka.ms/dotnet/twitter
TikTok: aka.ms/dotnet/tiktok
Mastodon: aka.ms/dotnet/mastodon
LinkedIn: aka.ms/dotnet/linkedin
Facebook: aka.ms/dotnet/facebook
Docs: learn.microsoft.com/dotnet
Forums: aka.ms/dotnet/forums
🙋‍♀️Q&A: aka.ms/dotnet-qa
👨‍🎓Microsoft Learn: aka.ms/learndotnet
#dotnet

Пікірлер: 64
@antheus_s
@antheus_s 5 ай бұрын
I love the vibe of this presentation, very casual. Amazing work, can't wait to work with it. 🙂
@vinny6935
@vinny6935 5 ай бұрын
I've been writing C# since 2003, and I feel like .NET 8 is the new ".NET 3.5" - this will be used for everything. It's really good, thank you for all the work on it!
@2SHARP4UIQ150
@2SHARP4UIQ150 7 ай бұрын
Anything that facilitates anti-pattern, I have reservations. When you try to make a language too adaptable, it will make Lead developers additionally cautious at allowing and deciding how and when these features are justifiable to use. Is always good to have more features but presumably these features are target-specific to bring more Javascript developers to the platform.
@mihalyv.9554
@mihalyv.9554 5 ай бұрын
@0:00 Introduction and Overview @1:50 Using Type Alias Enhancements @4:30 Primary Constructors for Classes and Structs @15:20 Constructor Chaining @22:45 Collection Expressions @30:10 Spread Operator in Collections @35:40 List Patterns and Collection Expressions @40:00 Closing Remarks
@dgkimpton
@dgkimpton 7 ай бұрын
Some of these features are excellent and it won't be long until we wonder how we ever managed without them. Others such as duality of field/parameters with the same name are rather ugly, I think I'd rather have seen a syntax that just marked the parameter as a field. public class Student(prop string Name, field int id, Grade[] grades) { But whatever, I still think this will see a lot of use. Also, absolutely yes on the readonly tag.
@andrekohler5792
@andrekohler5792 7 ай бұрын
I don't know if I will ever need the primary constructors for regular classes, but the collection expressions look really useful, especially for immutable collections. I like that you could actually just forget the old syntax and only use the new one.
@howardreagor2128
@howardreagor2128 7 ай бұрын
if you are using dependency injection, it can make a big difference in ceremonial code. In just one class I removed 60 lines of code with this feature.
@ChristopherShaw
@ChristopherShaw 7 ай бұрын
yeah this is making the DI boilerplate much more minimal. I'm liking it a lot.
@josefromspace
@josefromspace 7 ай бұрын
Thank you for this presentation. After having used .Net 8 RC2 on a project which is over 4K lines of code now I can attest this version is great. Kudos to the C# Team for such a great job.🎉
@doumkatekz
@doumkatekz 7 ай бұрын
It would be useful if there were more chapters in the main content
@anm3037
@anm3037 7 ай бұрын
The in-line modifiers for primary constructor will be great
@dcuccia
@dcuccia 7 ай бұрын
Agree, especially for DI scenarios. Probably won't use PCs for production stuff, though, without readonly modifiers. Not sure why parameters are captured instead of auto-gen'd fields. Maybe for perf/layout?
@jacobstamm
@jacobstamm 7 ай бұрын
Is there a reason the term "capture" is used in C# for what is generally referred to in programming as "closures"? It seems functionally (haha) equivalent, so why introduce another term for us to learn?
@VitaliChuzha
@VitaliChuzha 7 ай бұрын
Despite on my prev comment - thanks for the presentation.
@tacticalassaultanteater9678
@tacticalassaultanteater9678 2 ай бұрын
Very cool, except that name.Length there at 19:00 where did that landmine of an automatic refactoring come from???
@martinmeeser8312
@martinmeeser8312 7 ай бұрын
I am just loving modern day C#! 💙
@coderdenewbie
@coderdenewbie 7 ай бұрын
In Roslyn in dotnet 8, a warning has been introduced to use case insensitive comparison rather than .tolower() etc. To make the code more efficient, however, can't we still use tolower() and you change this to the more optimal code at the il level (so no memory is allocated). The current downside with the warning is the code becomes unreadable, and I have disabled the warning. I would like to keep the elegance of using tolower() and have the language select the optimal code, just like collection expressions.
@Neme112
@Neme112 3 ай бұрын
No it doesn't become unreadable, the code says exactly what it does - a case insensitive comparison. Also, that's not a suggestion from Roslyn, but from the. NET SDK.
@Neme112
@Neme112 3 ай бұрын
Also, it can't be changed automatically, because this is not only about efficiency, but also about correctness when using culture sensitive comparisons.
@Madius1906
@Madius1906 7 ай бұрын
thankfully I write a lot code in typescript which makes much easier to read a c# now...
@AQlexe
@AQlexe 5 ай бұрын
C# N - write what you want, we use AI to understand what you mean))
@TheBesogon
@TheBesogon 7 ай бұрын
collections look like in typescript. and the syntax is becoming closer and closer to JS.. that's not bad
@PomboRuanito
@PomboRuanito 7 ай бұрын
First of all, thanks for the presentation, second: how about a new accessor "notify" for ViewModel classes? like public string Name { get => _name; set => _name = value; notify => Name; } (this notify accessor would basically call OnPropertyChange(nameof(Name)) or OnPropertyChanged(new[] { nameof(Name), nameof(EnforcedName) }); I think it would be cool to have, and also would reduce lots of same code... who else think this would be good?
@2Fast4Mellow
@2Fast4Mellow 7 ай бұрын
We've developed a source generator that automatically generates these calls if the class inherits from the NotifyPropertyChanged base class, which, in turn, implements the interface. When a property or field is marked with a Notify attribute, the source generator modifies the code to include calls to (I)NotifyPropertyChanged. Building it wasn't too complicated (about 24 hours including testing), and it functions seamlessly for both the old-school full 4.8 framework and the more modern dotnet core...
@jacobstamm
@jacobstamm 7 ай бұрын
I can see the use case for sure, but I don't like the idea of the compiler having to be smart enough to know that the property name is indeed being passed as the "name" parameter for this specifically-named method. I think use of an attribute like what @2Fast4Mellow describes is a better solution.
@LunaticEdit
@LunaticEdit Ай бұрын
C# is my favorite language, but I won't be using primary constructors. If I wanted 80 different ways to do the same thing I'd use JavaScript or C++.
@blank3525
@blank3525 7 ай бұрын
why aliasing nullable reference types not allowed ?
@TheWolverine1984
@TheWolverine1984 7 ай бұрын
what are the m near the grade? 1.5m?
@swdev245
@swdev245 7 ай бұрын
The 1.5 is a decimal type if you write it as 1.5m, just like you write 1.5f to get a (32 bit) float.
@Miggleness
@Miggleness 7 ай бұрын
it’s million. 1.5 million.
@TheWolverine1984
@TheWolverine1984 7 ай бұрын
@@swdev245 thanks!
@jacobstamm
@jacobstamm 7 ай бұрын
I can't imagine myself ever naming a field and a default parameter the same thing. Seems like an easy way to get into trouble. I'm already used to prefixing private field names with underscores, and I can't think of a better time to use it. *private readonly int _id = id;* 👍
@AQlexe
@AQlexe 5 ай бұрын
using Grade = decimal. why??? IEnumerable everyone will understand as list of Enums or classes. Some years after c# -> JavaScript -> TypeScript ((
@GuildOfCalamity
@GuildOfCalamity 7 ай бұрын
Please use dark theme, I'm blind now... thx
@jacobstamm
@jacobstamm 7 ай бұрын
I too prefer dark theme, but for a lot of people, light theme is better for accessibility. You and I can always turn our display brightness down, but some people are going to struggle to see a dark theme editor even at full brightness.
@vivekkaushik9508
@vivekkaushik9508 6 ай бұрын
For demos light theme is better. Decrease your screen brightness mate.
@habiks
@habiks 5 ай бұрын
"newsless"
@redouane5626
@redouane5626 7 ай бұрын
unnecessary features that incentivize unreadable code :(
@hero3616
@hero3616 7 ай бұрын
Not all but most
@jaymartinez311
@jaymartinez311 5 ай бұрын
I’m new to dotnet and like these features but the level of complaining in some of these comments seems like this community can be opinionated like the js/ts community 😂. 🍿 🎥 What do some of these people want for AI 🤖 to actually replace developers altogether? 🤔 things change. If you don’t like them, then don’t use these features. Simple. Great job to the people that created these new features 🎉
@andyh5391
@andyh5391 7 ай бұрын
Seems we are moving towards even more unreadable code.
@cn-ml
@cn-ml 7 ай бұрын
To me it looks like the exact opposite. The programming language is getting more and more functional programming features and declarations that previously required lots of dead boilerplate code is now a lot more condensed and less error prone.
@2Fast4Mellow
@2Fast4Mellow 7 ай бұрын
@@cn-ml'public int Id => id = id' is a very wrong thing to have in your code. Constructor fields should not have 'scope' outside the constructor. Is is just that wrong to assign it from the ctor body? Make for much more readable code and don't get me started about the Pascal cased properties in a primary constructor definition. I doubt that it is less error prone for developers that work in multiple languages. I like the immutable collections, but a lot of the sugar syntax is not for me...
@vivekkaushik9508
@vivekkaushik9508 6 ай бұрын
​Agreed. I don't understand all the hate.
@nobody-00-00
@nobody-00-00 7 ай бұрын
I hate that you use this no Main Class style. Think about people who start programming. And FWord , C# looks now like a scripting Language and there are 1000 ways to make one stupid thing.
@spiralni
@spiralni 7 ай бұрын
Why are you destroying c#!?
@vivekkaushik9508
@vivekkaushik9508 6 ай бұрын
Lmao
@dartharc4n1ne5
@dartharc4n1ne5 7 ай бұрын
It is honestly amazing how these people manage to make C# uglier and more unreadable with every iteration.
@hero3616
@hero3616 7 ай бұрын
Lol true
@jeffb1106
@jeffb1106 7 ай бұрын
I've been using C# since the beta in 2001. I've loved the language. Now I'm starting to get frustrated with the bloating. I'd wish they'd stop adding unnecessary things to it.
@spiralni
@spiralni 7 ай бұрын
They asked chatgpt how to mix all the ugliest features from all the languages into c#
@VitaliChuzha
@VitaliChuzha 7 ай бұрын
A lot of trickery... For what?
@dcuccia
@dcuccia 7 ай бұрын
Elegant, expressive, and concise code that is robust under changing implementation details? Yeah, no idea.
@joshnjoshgaming
@joshnjoshgaming 7 ай бұрын
@@dcucciaxD
@Joooooooooooosh
@Joooooooooooosh 6 ай бұрын
Agree. This feels messy.
@jeffb1106
@jeffb1106 7 ай бұрын
Mads, Dustin, STOP adding unnecessary additions to the language. It's starting to become hard to read. There are too many new features we have to know. AND they even create a new type of errors. Watch at: @13:18 .
@Rajdadaj
@Rajdadaj 7 ай бұрын
Oh my, this language is turning ugly. The new coders at work will insist on using ALL these new shitty features.
@Maniakatus
@Maniakatus 6 ай бұрын
I'm not sold on primary constructors for classes, far from it, but the new collection initializing syntax is both prettier, shorter and more performant. I'm all for *that* one at the very least. Each new feature has its uses, and it's up to the senior devs and architects to make sure that new coders don't go overboard. If they're new coders, they need to be trained. With each new C# version, that training gets more extensive. That's where [Obsolete] comes in, to keep us somewhat sane. Sometimes.
@Christobanistan
@Christobanistan 3 ай бұрын
Just the worst features ever added. So confusing.
@talleyouro9271
@talleyouro9271 7 ай бұрын
You need to be more creative by adding more language features(Python and Java bring more new features to their language than C#)
@yvanricardoecarrigomez
@yvanricardoecarrigomez 6 ай бұрын
Why does Microsucks present new products with the exact same video format than 15 years ago? It sucks!
@ghaznavipc
@ghaznavipc 6 ай бұрын
Talking about being toxic...
@joselara02
@joselara02 5 ай бұрын
Now we just creating unnecessary crap on the language 🥱
All About C# Source Generators | .NET Conf 2023
27:59
dotnet
Рет қаралды 23 М.
Вечный ДВИГАТЕЛЬ!⚙️ #shorts
00:27
Гараж 54
Рет қаралды 13 МЛН
FOOLED THE GUARD🤢
00:54
INO
Рет қаралды 63 МЛН
Was ist im Eis versteckt? 🧊 Coole Winter-Gadgets von Amazon
00:37
SMOL German
Рет қаралды 29 МЛН
6 INSANE Things You Didn't Know You Could Write in C#
12:26
Nick Chapsas
Рет қаралды 50 М.
Full stack web UI with Blazor in .NET 8 | .NET Conf 2023
55:56
C++ Weekly - Ep 435 - Easy GPU Programming With AdaptiveCpp (68x Faster!)
15:30
C++ Weekly With Jason Turner
Рет қаралды 10 М.
One Unique Fact for Every Unique Unit (Part 1: letters A-K)
12:41
Spirit Of The Law
Рет қаралды 37 М.
What's new in C# 10
29:28
dotnet
Рет қаралды 86 М.
What's New in C# 11 | .NET Conf 2022
30:28
dotnet
Рет қаралды 27 М.
.NET Containers advancements in .NET 8 | .NET Conf 2023
25:38
Игорь Лабутин - Что нового в .NET 7 и C# 11
1:00:17
DotNext — конференция для .NET‑разработчиков
Рет қаралды 5 М.
ПОКУПКА ТЕЛЕФОНА С АВИТО?🤭
1:00
Корнеич
Рет қаралды 3,5 МЛН
После ввода кода - протирайте панель
0:18
Up Your Brains
Рет қаралды 1 МЛН
Ультрабюджетная игровая мышь? 💀
1:00