No video

C# 9 Language Features

  Рет қаралды 62,811

dotnet

dotnet

Күн бұрын

Пікірлер: 184
@xenopheliac7202
@xenopheliac7202 3 жыл бұрын
Love that C# keeps growing functional. Soon I won't have to beg people to do Haskell at work.
@willinton06
@willinton06 3 жыл бұрын
@@PaulSebastianM too abstract for most, including me
@obinator9065
@obinator9065 3 жыл бұрын
@@PaulSebastianM don’t like the syntax
@TNothingFree
@TNothingFree 3 жыл бұрын
When I learned Kotlin all I was thinking was "Why C# doesn't have it?" You can see real progress when you look at new languages like Kotlin and Rust which are absolute stunning from my point of view. Because they already implement immutability and record classes. Awesome!
@obinnaokafor6252
@obinnaokafor6252 3 жыл бұрын
Scala is better with those things.
@reubenator
@reubenator 3 жыл бұрын
"Stunning" is the correct word, when a language construct just allows you to express your intent without the word salad. I actually love that these languages continue to evolve, refine and learn from each other, it ultimately helps us devs "get to the point"
@matsalritzson3492
@matsalritzson3492 3 жыл бұрын
It doesn't go only one way. Rust is copying async/await from C#.
@AlexFeature
@AlexFeature 3 жыл бұрын
The one thing that I absolutely love about C# is its elegance. It is such an intuitive and beautiful language.
@calvinwilson3617
@calvinwilson3617 3 жыл бұрын
Bringing some of the advantages of js/ts into C# just in time for blazor, i love it
@JosephHerrington
@JosephHerrington 3 жыл бұрын
With the changes in 7.x, 8 and now 9, it seems like they are laying the groundwork for transitioning to a more Functional style of programming. This reminds me of Scala. And I’ve always been a fan of Scala!
@beshy9012
@beshy9012 3 жыл бұрын
I love c#.net core
@johnthetactician
@johnthetactician 3 жыл бұрын
Hell yeah, screw Java
@charlesbaldo
@charlesbaldo 3 жыл бұрын
N7 Commander John Adopt Blazor and you can screw JavaScript too.
@hanspetervollhorst1
@hanspetervollhorst1 3 жыл бұрын
waiting for go#
@willinton06
@willinton06 3 жыл бұрын
@@hanspetervollhorst1 G#
@cascadengineering
@cascadengineering 3 жыл бұрын
Blazor is not fit for interactive web-sites and is worse than React+TypeScript+ModX where you can also leverage SignalR to talk to C# API.
@r1pfake521
@r1pfake521 3 жыл бұрын
What's the behavior of records with "advanced" types instead of basic string or int, for example will it be possible to add a List or Dictionry property to a record? How will it be immutable, since the List itself can still be changed? How will the copy (with expression) work with these types, will it "copy" the list reference or will it create a real copy of the list? How will it work with custom types as record properties, how will it be able to copy these or will it just "copy" the reference of these properties?
@yusufmohamedsalh8321
@yusufmohamedsalh8321 3 жыл бұрын
I think video is quite non explainory ,the one should try it himself
@rabidtommy
@rabidtommy 3 жыл бұрын
Asking all the difficult questions, ones which will need answers
@ehsnils
@ehsnils 3 жыл бұрын
One thing that I think that records should have is a way to declare common fields for multiple records, especially for the case where you have the records stored in a database table where you want to have a unified declaration of primary key.
@facundo91
@facundo91 3 жыл бұрын
07:58 You mean "p1 == p3: {isEqual}". Please add a note, otherwise is confusing.
@briannielsbergh
@briannielsbergh 3 жыл бұрын
one word: AWESOME!!!!.....love the progress in the C# language.... .P Keep up the good work.
@zemom.a.8171
@zemom.a.8171 3 жыл бұрын
I wonder if theres ever gonna be rust-like memory handling? Instead of creating Verona to implement safe memory deallocation why not make this a thing in C# for the devs that need it?
@Rafael-vn2bo
@Rafael-vn2bo 3 жыл бұрын
C# 9, years ahead of Java.
@ryanleemartin7758
@ryanleemartin7758 3 жыл бұрын
F# 4, years ahead of C#9 . Sorry, I couldn't help myself.
@danielecerro3797
@danielecerro3797 3 жыл бұрын
@@ryanleemartin7758 Q#, billions years ahead?
@charlesbaldo
@charlesbaldo 3 жыл бұрын
Daniele Cerro Z# the Omega
@ryanleemartin7758
@ryanleemartin7758 3 жыл бұрын
@@danielecerro3797 HA! well If quantum computing was actually real, maybe. Let's hope!
@ryanleemartin7758
@ryanleemartin7758 3 жыл бұрын
@@charlesbaldo Shit. I'd try Z# the Omega.
@Conficient
@Conficient 3 жыл бұрын
Great description of records and why you would use them, thanks
@lbobrov
@lbobrov 3 жыл бұрын
I remember, that somewhen in the years between 2000 and 2007, there was a video podcast series which was called "The .NET Show" with Erica Wiechers :)
@ericnyamu9981
@ericnyamu9981 3 жыл бұрын
does the female name make it easy to remember the show ? lol
@SOMEONE-eq5bu
@SOMEONE-eq5bu 2 жыл бұрын
@@ericnyamu9981 lol 😂😂🤣🤣, good point
@helshabini
@helshabini 3 жыл бұрын
I wonder how would records work with EF. If I change an object in my context via a wither, will it change the record value in the database or recreate it with a brand new Id?
@simplegameplay1469
@simplegameplay1469 3 жыл бұрын
Definitely looking forward to use C# 9, 8 was an amazing entry. Now is there any way of making infix functions or there will be?
@nissanGold
@nissanGold 3 жыл бұрын
Wow records look like a really good and valuable feature! Great job dev team :)
@obinnaokafor6252
@obinnaokafor6252 3 жыл бұрын
Yes it is very a valuable feature. Soon we will have record struct also. And these underpinning would help pave way for a better and superior discriminated union (DU) feature in C#.
@konstantinsarychev9305
@konstantinsarychev9305 3 жыл бұрын
Nice, but what about lists (or other custom ref types) inside records? Are the also going to be compared by content? And are they also get assigned by cloning the entire content?
@jackshen1028
@jackshen1028 3 жыл бұрын
Haskell has a huge code base for the immutable record style
@jasonracey9600
@jasonracey9600 3 жыл бұрын
Every new C# version comes with a "new" feature that Scala has already had for a decade. Maybe C# 10 will have Option[T]? Or function currying? Or everything immutable by default? Place your bets.
@RenegadeVile
@RenegadeVile 3 жыл бұрын
Nearly every feature from every language has been done at some point somewhere else. Keep in mind that they're not claiming to have invented the wheel here. This is a new feature FOR C#, not a new feature among all programming languages.
@TheRetrospective
@TheRetrospective 3 жыл бұрын
Now that one sees this, it's so obvious. I'm only wondering why this wasn't part of C# much earlier, like 10 years ago? I guess sometimes innovation takes time to emerge and implement.
@orlovsskibet
@orlovsskibet 3 жыл бұрын
Your user name is so much embodied in your comment 😁
@bar10dr
@bar10dr 3 жыл бұрын
Awesome video, great dev presentation
@IBITZEE
@IBITZEE 3 жыл бұрын
That guy really knows his stuff...
@aregaz21
@aregaz21 3 жыл бұрын
Love your explanation, guys. Thanks for making this video 👍
@NevadaWilliford
@NevadaWilliford 3 жыл бұрын
Personally, I think this looks great. Also, very clearly presented. Great job.
@phantastik3389
@phantastik3389 3 жыл бұрын
I hope you guys have a book ready so can study c#9
@SJ-mp2hk
@SJ-mp2hk 3 жыл бұрын
This was awesome! Thank you 🙏🏾
@FilipCordas
@FilipCordas 3 жыл бұрын
I like typescript syntax with {...p1} then the f# way makes a bit more sense. On that question can you use with keyword with two different record types?
@Kitulous
@Kitulous 3 жыл бұрын
Why would you need it? 'with'-expression allows you to get an existing record WITH some other properties. If you need to fully overwrite the record just pass the second one lol.
@FilipCordas
@FilipCordas 3 жыл бұрын
@@Kitulous It just a personal preference mostly because it would work for arrays as well not just objects. And this is not only a see for using modified object you do use it for shallow copies as well
@yusufmohamedsalh8321
@yusufmohamedsalh8321 3 жыл бұрын
Hi Jared,you should press 'insert' to get rid of the cursor.
@joshdeshazer1698
@joshdeshazer1698 3 жыл бұрын
I love it ready to use records. Thank you team
@marcosrocha
@marcosrocha 3 жыл бұрын
So, we might substitute our POCO classes for records?
@s3rg3yg
@s3rg3yg 3 жыл бұрын
And DTOs
@RenegadeVile
@RenegadeVile 3 жыл бұрын
That's pretty much what records would be useful for yeah.
@mp9508
@mp9508 3 жыл бұрын
Syntactic saccharin.
@chrissolutions
@chrissolutions 3 жыл бұрын
@@JP-hr3xq Disagree. I love switch expressions.
@Novalarke
@Novalarke 3 жыл бұрын
C#9? I know it well: C#, E#, G#, B and D# . . . What? Oh.
@hanspetervollhorst1
@hanspetervollhorst1 3 жыл бұрын
Can you define methods on records?
@r1pfake521
@r1pfake521 3 жыл бұрын
Yes, it's just "syntax sugar" they are still normal classes, you can even subclass them.
@RenegadeVile
@RenegadeVile 3 жыл бұрын
Like the other commenter said, all record does is generate common operations for value types for you. So member-by-member equality comparison, etc. things you would commonly do when implementing interfaces like IEquatable. But beyond that, it's still just a class so you can do everything else with them that you can with a class. However, once you start considering adding complex methods and states to your record, you should start asking yourself the question whether it should be a record at all.
@RayHorn5128088056
@RayHorn5128088056 3 жыл бұрын
Could have done record with a smart superclass but what they hey. Kudos for the effort.
@obinnaokafor6252
@obinnaokafor6252 3 жыл бұрын
What do you mean by "with a smart superclass"? Just asking an honest question. Thank you.
@Kitulous
@Kitulous 3 жыл бұрын
@@obinnaokafor6252 Probably something like class Person : Record {} which would take care of equality and stuff
@RenegadeVile
@RenegadeVile 3 жыл бұрын
@@Kitulous Wouldn't you, at some point, still need to define the equality comparison, for example? A member-by-member comparison? This is something that record also avoids. If you add a new property to Person, but forget to add it to your equality check, you've introduced a sometimes subtle bug.
@freezefrancis
@freezefrancis 2 жыл бұрын
Records are just scala case classes i believe
@paulfunigga
@paulfunigga 3 жыл бұрын
A whole zoo of features
@Zapanath
@Zapanath 3 жыл бұрын
I guess we can get rid of F# now. Records is only new to C# , F# devs have had records for ages.
@Samiron
@Samiron 3 жыл бұрын
Is the record reference type? Can I create value type "record"?
@tbg10101
@tbg10101 3 жыл бұрын
When will I be able to use some of these nice things with readonly structs?
@krigrtrue
@krigrtrue 3 жыл бұрын
Where is extend everything
@DheerajUthaiah
@DheerajUthaiah 3 жыл бұрын
Wow!!
@ihorbond
@ihorbond 3 жыл бұрын
Amazing! Excited to try these out in the .net 5 app I'm about to build for a client !
@clay9963
@clay9963 3 жыл бұрын
He uses vsvim...
@joaoalexandretoledo3884
@joaoalexandretoledo3884 3 жыл бұрын
He wrote VsVim!
@willinton06
@willinton06 3 жыл бұрын
@@joaoalexandretoledo3884 damn
@Rauly4557
@Rauly4557 3 жыл бұрын
Very Cool!
@brunoccs
@brunoccs 3 жыл бұрын
What's the difference between struct and record?
@willinton06
@willinton06 3 жыл бұрын
Deconstruction is easier
@ikanreed816
@ikanreed816 3 жыл бұрын
Records aren't value types, regardless of whether they're mutable, they're still passed up and down the stack as references.
@wizardarss
@wizardarss 3 жыл бұрын
Such magic only hurts. Make better compilation with CoreRT. Good innovations: stack allocated, intrinsiсs, BCL optimization, nothing else.
@zemom.a.8171
@zemom.a.8171 3 жыл бұрын
Project snowflake/Rust-like deallocation would also be a very nice tool for developing every application thats involved in the media/digital art industry.
@Esico6
@Esico6 3 жыл бұрын
Feedback from customers? Which customers? C# and .Net is free.
@piromanaBG
@piromanaBG 3 жыл бұрын
You can pay for support
@willinton06
@willinton06 3 жыл бұрын
KZbin is free yet we’re KZbin customers
@crash1998100
@crash1998100 3 жыл бұрын
18:20 Why not just use readonly
@zemom.a.8171
@zemom.a.8171 3 жыл бұрын
Yeah...
@r1pfake521
@r1pfake521 3 жыл бұрын
One difference between readonly and init is that you can set init properties in an object initializer syntax which is not possible with readonly
@crash1998100
@crash1998100 3 жыл бұрын
@@r1pfake521 Oh, I thought it was. Kinda weird that's not possible for readonly
@davidmil15
@davidmil15 3 жыл бұрын
@@crash1998100 it’s not weird really. The initializer syntax is just sugar for setting properties and that happens after construction.
@LivingTheDream21
@LivingTheDream21 3 жыл бұрын
I feel like Rich Lander is abrasive or condescending. 1:06 6:02 and probably more, but I'm just at the 6 minute mark.
@mihaimyh
@mihaimyh 3 жыл бұрын
So, records are the way to go from now on, we ditch classes?
@zemom.a.8171
@zemom.a.8171 3 жыл бұрын
Well, records ARE classes. And in OOP,mutating states are sometimes requires. If you, for example, have a UI system and bind a textbox to a string-property to determine a class's state, then making the class immutable would be counter-productive since often times user-input needs to mutate object-state.
@r1pfake521
@r1pfake521 3 жыл бұрын
@@zemom.a.8171 I always wonder what kind of software the "everything immutable" people develop, because I can't see how developing something like editor with UI or games with so many game states would work reasonable without mutable objects, it sounds like a horrible mess to me, but maybe im just not lighted by the power of "everything immutable" yet.
@matsalritzson3492
@matsalritzson3492 3 жыл бұрын
@@r1pfake521 In a proper functional programming language you have copy on write. Under the hood it's still references to the same objects. But once you start to change something you create a copy of it and do your modifications there. The cool thing is that this simplifies stuff alot when dealing with threading. Some stuff will be more difficult, but others will be alot easier.
@RenegadeVile
@RenegadeVile 3 жыл бұрын
No, records will be primarily useful for DTOs or plain old data classes. If you have any experience with C++, for example, there we would use structs that just contain some public members and that's it. For things that still require methods, state or complex logic, you'll still want to use classes. Especially if you need reference semantics for your type as opposed to value.
@CoryTaylor904
@CoryTaylor904 3 жыл бұрын
So basically, they are picking f# features and running with it.
@bruceke13
@bruceke13 3 жыл бұрын
OMG MY EYES, THE WHITEMODE
@3N35
@3N35 3 жыл бұрын
Voavv. Çok iyi olmuş.
@3D_Printing
@3D_Printing 3 жыл бұрын
"Hello world,"
@gavinlangley8411
@gavinlangley8411 3 жыл бұрын
Record sounds great but you need the idea of key, key matching and data not equal. So you need something like Record as (TKey, TValue) ...
@user-gt2gy8wo3h
@user-gt2gy8wo3h 3 жыл бұрын
Could you pls share the vim emulator extension name you were using in VS?
@obinnaokafor6252
@obinnaokafor6252 3 жыл бұрын
marketplace.visualstudio.com/items?itemName=JaredParMSFT.VsVim
@ifelseprog
@ifelseprog 3 жыл бұрын
He wrote it, by the way
@tarasov9794
@tarasov9794 3 жыл бұрын
It's a bit disturbing to see a space between method name and {, and no space between method name and (. But at least you use the superior bracing method. ;)
@rehanahmed6210
@rehanahmed6210 3 жыл бұрын
👍👍👍
@madmonad3678
@madmonad3678 3 жыл бұрын
Sadly immutability is still not fully embraced; as "x with { ...}" is a poor substitute for value optics like lenses. Secondly it's ridiculous that C# still hasn't added a discriminated union type similar to F#.
@mariacobretti
@mariacobretti 3 жыл бұрын
PogChamp
@siyabongadlamini2904
@siyabongadlamini2904 3 жыл бұрын
I love it
@nitsanbh
@nitsanbh 3 жыл бұрын
“Records” exist in Python and Kotlin for years now... they’re called “Data Classes”
@RenegadeVile
@RenegadeVile 3 жыл бұрын
WEll, in all fairness, in C# itself, they're also existed since its inception. Either use structs or implement the required overrides and interfaces in a class. This is just a quality of life improvement.
@47Mortuus
@47Mortuus 3 жыл бұрын
delegate*
@uthoshantm
@uthoshantm 3 жыл бұрын
I feel C# is becoming more and more bloated.
@sps014
@sps014 3 жыл бұрын
I Don't think so, C# is evolving in the right direction.
@nissanGold
@nissanGold 3 жыл бұрын
Most of these features look like syntatic sugar if you dont want to learn it you dont have to.
@brokula1312
@brokula1312 3 жыл бұрын
@@nissanGold And how do you know what you have to or not to learn? It is bloated. Beside C++ probably the biggest bloat in industry.
@obinnaokafor6252
@obinnaokafor6252 3 жыл бұрын
That is a very wrong notion to hold. C#/ .NET is still one of the top fastest and most productive platform out there. With record, one can cut down all the ceremonies and boilerplates codes. Unless you are being paid by the lines of code you write?
@obinnaokafor6252
@obinnaokafor6252 3 жыл бұрын
@@brokula1312 So you would want C# to just remain the way it is since 20 years ago? If not there would not have been LINQ, Lambdas, async await, extension method etc. Languages which are still relevant evolve. And C# is still one of the relevant languages out there. Records are good with machine learning and building models. And it helps cut down some boilerplates. Even Java is getting reocrds.
@josephang9927
@josephang9927 2 жыл бұрын
I hate that fat cursor.
@NativeEngine2017
@NativeEngine2017 3 жыл бұрын
Only C++ )))
@RenegadeVile
@RenegadeVile 3 жыл бұрын
My mind went straight to C++ too at the sight of record.
@westernvillager
@westernvillager 3 жыл бұрын
Very nice talk! But please improve your typing 😜
@anomalii7720
@anomalii7720 3 жыл бұрын
Hmmm, something i will NOT use.
@vivekvenugopal8411
@vivekvenugopal8411 3 жыл бұрын
That makes two of us
@r1pfake521
@r1pfake521 3 жыл бұрын
Same, for these "dumb" serialization classes I never cared about value equality, constructor deconstruct or anything like that, so they only contain public get, set properties which isn't really that much code and I would rather have the "default" reference equality in the rare cases where equality is used for example if I have to remove these objects from a list or dictionary I want to remove the actual instance I pass and not some other instance which has the same values.
@user-dy8dl6xu5w
@user-dy8dl6xu5w 3 жыл бұрын
Too weird syntax
@obinnaokafor6252
@obinnaokafor6252 3 жыл бұрын
How is it weird? Could you clarify?
@user-dy8dl6xu5w
@user-dy8dl6xu5w 3 жыл бұрын
1. Why can not create a new instance "inline" without a ctor without the new keyword init? (duplicate ctor for example)
@willinton06
@willinton06 3 жыл бұрын
@@user-dy8dl6xu5w that’s as old as time, it’s not a C# 9 feature
@janjoska2549
@janjoska2549 3 жыл бұрын
Jees, use resharper.
@kotzulla
@kotzulla 3 жыл бұрын
someone still using c#????
@RenegadeVile
@RenegadeVile 3 жыл бұрын
Yes? A lot of people? A lot of people also still use C and C++, both to great effect. Programming language is just a tool. It's much more important how you use it, and what you use it for.
@jake8217
@jake8217 3 жыл бұрын
Oh my sweet summer child...
@dsmyify
@dsmyify 3 жыл бұрын
It feeds the family.
@marcusreinicke
@marcusreinicke 3 жыл бұрын
Excuse me, but I find most innovations easy especially those that were not shown, just garbage. Most changes make the source code less legible. Unfortunately, this is not an innovation, it is something that very specific people wished for. It seems to me that you don't have any decent ideas for improving the C # language. Maybe you should turn away from C # slowly, because the straight lines are becoming more and more weakened. That's my personal opinion, but it makes me sad to see C # continue to degenerate. I would advise a programming team to forbid C # 9.0 in the style guides. Only bad
@asadahmed4993
@asadahmed4993 3 жыл бұрын
Haha copying python now! no wonder Python is the boss 😎
@obinnaokafor6252
@obinnaokafor6252 3 жыл бұрын
Async & await? Linq and Lambdas? Auto-properties? Lol
@piromanaBG
@piromanaBG 3 жыл бұрын
Sorry: IndentationError
@paulwojcik1856
@paulwojcik1856 3 жыл бұрын
Have just learnt Python (for a real job), been programming professionally since DOS 3.3 and have used every language you can imagine. Thank god I have C# for my job (Windows/Linux/Cloud + embedded) and don't have to use Python all the time, what an awful piece of work that is. Passing self to every class member so that it knows it is itself (even though I indented under a class def), really? Its like handing myself my own picture and ID every morning just to know who I am when I wake up. And what about a ++ operator so I can increment values inline (C and C++ had it when python come along) or a simple switch statement, huh? Maybe Python should get the basics right before bragging :-)
@milisha98
@milisha98 3 жыл бұрын
@Asad Ahmed Records were found in many languages before Python was even a twinkle in Guido van Rossum's eye. Even other Microsoft languages, such as F# even has had records and discriminated unions since inception.
@RenegadeVile
@RenegadeVile 3 жыл бұрын
No language is the boss. Depends on what you need done.
@Esico6
@Esico6 3 жыл бұрын
This is so ugly. Yak.
What's new in C# 10
29:28
dotnet
Рет қаралды 87 М.
5 New Features in C# 9 (not including Records)
1:11:00
IAmTimCorey
Рет қаралды 81 М.
Running With Bigger And Bigger Feastables
00:17
MrBeast
Рет қаралды 159 МЛН
What's New in C# 12 | .NET Conf 2023
35:28
dotnet
Рет қаралды 56 М.
Intro to Records in C# 9 - How To Use Records And When To Use Them
1:19:44
What's New in C# 11 | .NET Conf 2022
30:28
dotnet
Рет қаралды 27 М.
C# Source Generators - Write Code that Writes Code
28:36
dotnet
Рет қаралды 49 М.
The Worst Programming Language Ever - Mark Rendle - NDC Oslo 2021
1:00:41
NDC Conferences
Рет қаралды 1,3 МЛН
Every New Feature Added in C# 12
14:19
Nick Chapsas
Рет қаралды 150 М.
The Ultimate Guide to C# Records
12:55
Zoran Horvat
Рет қаралды 18 М.