What's New in C# 8.0

  Рет қаралды 299,491

Microsoft Visual Studio

Microsoft Visual Studio

5 жыл бұрын

Several new language features are coming to C# in the next release, included in Visual Studio 2019. Mads Torgersen will give us a quick look at how to avoid null reference exceptions with nullable reference types, how to consume and produce asynchronous streams, and much more.
Twitter: @MadsTorgersen
Learn more about C# 8.0: aka.ms/csharp8

Пікірлер: 620
@SergiuTalnaci
@SergiuTalnaci 5 жыл бұрын
0:34 - 5:34 Nullable reference types 5:35 - 7:48 Async streams 7:49 - 8:46 Array slice Thank you and best wishes to you and your team Mads, happy holidays from Aarhus.
@ACHUAskar
@ACHUAskar 5 жыл бұрын
Sergiu Talnaci MVC (Most Valuable Comment) Thanks Mate
@SkyLee91
@SkyLee91 5 жыл бұрын
Thanks god. It helps to save the video. LOL
@zhongwang3599
@zhongwang3599 5 жыл бұрын
what a convenient comment
@TarBazar
@TarBazar 5 жыл бұрын
Async Streams .. .Beautyyyyyy
@elboruboru
@elboruboru 5 жыл бұрын
C# 10.0 will read your mind: var person = new ("John", "Connor");
@refield6898
@refield6898 5 жыл бұрын
You also can do Person p = ("",""); trick with ValueTyple and implicit conversion
@ahdungai8489
@ahdungai8489 5 жыл бұрын
@@namelastname4077 Then we can var person = new (Encoding.ASCII.GetString(Convert.FromBase64String("JTI4LiUyMCUyOSUyOCUyMC4lMjk=")));
@SrIgort
@SrIgort 5 жыл бұрын
@@ahdungai8489 I think that the compiler would be able to optimize this and so block It.
@nosmirck
@nosmirck 5 жыл бұрын
new should be optional
@Happypig375
@Happypig375 5 жыл бұрын
Isn't it F# records? type Person = { FirstName: string; LastName: string } let person = { FirstName = "John"; LastName = "Connor" } Still have to specify the record labels though.
@dr.joint4204
@dr.joint4204 5 жыл бұрын
first 4 minutes is programming life in a nutshell... gets a bug, solved it.... puts in feature, gets 10 more bugs
@lionkor98
@lionkor98 5 жыл бұрын
I found it really amusing, too, lol
@tokertl9899
@tokertl9899 5 жыл бұрын
and we solve all the bugs until we get a running code lol
@mr.mikaeel6264
@mr.mikaeel6264 3 жыл бұрын
They say if you step on a cockroach it releases their eggs. In a sense the same as you would also get more bugs. Now the cockroach thing is a myth so does that make Microsoft a more anoying thing to deal with then? ^^
@fuzzylilpeach6591
@fuzzylilpeach6591 5 жыл бұрын
The switch expressions look so clean, basically like a truth table. Thats awesome!
@RobProuse
@RobProuse 5 жыл бұрын
It is an amazing time to be a C# programmer!
@madstorgersen7881
@madstorgersen7881 5 жыл бұрын
Good times indeed!
@PhillipMwaniki
@PhillipMwaniki 5 жыл бұрын
@A Hero Academia Not really. I've been doing Java n Js for a little over 2 years and I humbly admit that C# is the future
@TheAndrejP
@TheAndrejP 5 жыл бұрын
@A Hero Academia if you mean Electron apps, it's not the future, it's just an unfortunate turn of events that the most broken language out there is the easiest to port to different desktop and mobile systems because every system has a web browser nowadays. Python though... as a prototyping tool maybe... but reimplementing anything in python? Where? Why?
@nosmirck
@nosmirck 5 жыл бұрын
@@PhillipMwaniki Flutter and Dart are the future
@precogtyrant
@precogtyrant 5 жыл бұрын
@@nosmirck Typescript already ate Dart alive.
@MuhammadAhmed-vi2xt
@MuhammadAhmed-vi2xt 5 жыл бұрын
i used javascript,python,php,java. But i enjoyed alot to work with C# in its own best IDE visual studio. C# gives real understanding how programming language work in more disciplone way. Thumbs Up guys and Thank you for your great gift of C# 8.0.
@madstorgersen7881
@madstorgersen7881 5 жыл бұрын
Thanks for the kind words!
@FlameRat_YehLon
@FlameRat_YehLon 5 жыл бұрын
For some edge cases in math, F# is a bit more capable. But that edge seems to get smaller and smaller and maybe in the future F# will only really be useful for very abstract stuffs or for those who just hates brackets.
@edwinfcapidos
@edwinfcapidos 5 жыл бұрын
Just can't leave C#. The best modern programming language paired with the best IDE.
@idontusenumbers
@idontusenumbers 5 жыл бұрын
Rider? VS with ReSharper? Have you used IDEA?
@edwinfcapidos
@edwinfcapidos 5 жыл бұрын
idontusenumbers i tried VS with ReSharper and it's great. Just can't shell out money for that. I tried IDEA using Kotlin. It's good as well but not as great as VS.
@idontusenumbers
@idontusenumbers 5 жыл бұрын
VS consistently lags behind IDEA and ReSharper. Every feature demonstrated in the recent VS 2019 preview has been in IDEA for at least 5 years. It's been that way pretty consistently with each release.
@TheAndrejP
@TheAndrejP 5 жыл бұрын
​@@idontusenumbers depends on what you need, but the one thing that has been consistent as well is how bloated IDEA has been getting over the past few years. I guess more functional tools in the developers' arsenal also brings some negative consequences sometimes...
@idontusenumbers
@idontusenumbers 5 жыл бұрын
@@TheAndrejP what do you mean by bloated? It's driven by plugins; I have way more than the default set enabled and it loads fast, is very responsive, and never crashes. Visual studio feels more boosted to me and I can't turn of nearly as much.
@washington6986
@washington6986 5 жыл бұрын
I am profoundly thankful to the past me who decided to learn C# instead of *other languages*
@madstorgersen7881
@madstorgersen7881 5 жыл бұрын
I'm glad you learned C#! Don't hesitate to learn more languages too!
@madmanga64
@madmanga64 5 жыл бұрын
I agree especially with Blazor web assembly looming and now open source WPF
@ILovePancakes24
@ILovePancakes24 5 жыл бұрын
yea dude just focus on one language, instead of the foolish concept of learning the concepts under the language and being able to use any language ever written with minor effort like I did. :) (/s for chickenheads)
@ZoidbergForPresident
@ZoidbergForPresident 5 жыл бұрын
@@ILovePancakes24 This.
@dariusduesentrieb
@dariusduesentrieb 5 жыл бұрын
well you would think differently if you'd also learned C++23
@ozgurakpinar_gr
@ozgurakpinar_gr 5 жыл бұрын
Where is C# going? This is so absurdly good that I cannot believe all these are real (beginning from C# 7.0).
@madstorgersen7881
@madstorgersen7881 5 жыл бұрын
Glad you like it! :-)
@PiotrKula1
@PiotrKula1 5 жыл бұрын
Imagine how I feel. I started in VB5 🤪 no seriously though. C# is blowing my mind past few years
@r357bg
@r357bg 5 жыл бұрын
@@PiotrKula1 and still VB6 are much faster than this
@Craigeek
@Craigeek 5 жыл бұрын
C# is transforming from an Application Programming Language (Line of business "apps") to a Systems Programming language (OS)
@AnuragJ100
@AnuragJ100 5 жыл бұрын
The way this team executes on adding new features to this language is really excellent. I remember Anders talking about non-nullable reference types years ago, and they figured out how to do it in such an elegant way. Good stuff!
@teekwick
@teekwick 5 жыл бұрын
I think C# is the most elegant language out there today.
@grproteus
@grproteus 5 жыл бұрын
Definitely not elegant. "random" weird operators here and there and on a per-feature implementation does not make for an elegant language.
@rockmehunny
@rockmehunny 5 жыл бұрын
On the CLR Yes but not overall....look at kotlinlang.org/ Now they have taken inspiration from Java 8 Default methods on interfaces and null check from Kotlin.
@moofymoo
@moofymoo 5 жыл бұрын
but if you define "elegant" as "work horse for 9-18 job with some cool features you can tinker when you need to spend those 30minutes before next useless meeting" then it is!
@giovannisolimeno5040
@giovannisolimeno5040 5 жыл бұрын
OCaml would like to have a chat with you
@Sydra.
@Sydra. 5 жыл бұрын
Maybe there is too much boilerplate in C# but yeah it's a pretty nice language. I would be happier with some "global using" feature.
@brucepierson9941
@brucepierson9941 5 жыл бұрын
I can foresee default interface implementations being badly abused.
@stacklysm
@stacklysm 5 жыл бұрын
I though that too... This is just virtual methods all over again. But the other features were amazing, specially switch expressions
@abdoulrhmanrif4758
@abdoulrhmanrif4758 5 жыл бұрын
Thank you guys for taking such good care of us. :)
@Trillykins
@Trillykins 5 жыл бұрын
Was using Python yesterday for Advent of Code and thought that it would nice if we got array slicing for C#. Nice timing lol. Looks good!
@FlameRat_YehLon
@FlameRat_YehLon 5 жыл бұрын
F#: hey look at my clean code! C#: IT'S MINE NOW
@ThomasPoth
@ThomasPoth 5 жыл бұрын
Nullable-reftypes are amazing, thanks for that.
@FlameRat_YehLon
@FlameRat_YehLon 5 жыл бұрын
That feature is actually more of "non-nullable-reftypes" because everything used to be defaulted to be nullable :)
@TheUnlocked
@TheUnlocked 5 жыл бұрын
These features look amazing. I've been following the more abstract discussions on csharplang, but actually seeing the features used in a project is so much cooler.
@TomasVasquez
@TomasVasquez 5 жыл бұрын
Array slicing, FINALLY!!!!
@focl2003
@focl2003 5 жыл бұрын
How is that useful enough?, may be video games?
@greenvm
@greenvm 5 жыл бұрын
@@focl2003 It's useful for a million things, I'm using it when getting data from an array that contains FFT of audio
@focl2003
@focl2003 5 жыл бұрын
@@greenvm It should be, y use linq everywhere but I know it's not that low level.
@galatei11
@galatei11 5 жыл бұрын
yeah, but the syntax is horrible, why not just use the python syntax??? Too proud to admit it's better? array[1:2], array[:2], array[:-2], array[-3], etc... so much better!
@Happypig375
@Happypig375 5 жыл бұрын
But the range end is implicitly exclusive and can't be changed. D:
@TheFerdi265
@TheFerdi265 5 жыл бұрын
Non-nullable references, null-warnings for nullable references, async streams, better inference for new, and FINALLY switch expressions with patterns and exhaustiveness checking. C# is getting more and more functional, and taking notes from other functional and functionally-inspired languages like Scala, MLs, Haskell, or Rust (or F# ;P) Hoping C# will get something similar to Rust's Enums (like type-safe tagged unions) or Scala's Case Classes. All these code readability, expressiveness, and conciseness improvements, in addition to type-safety improvements (null is now completely a type-system thing) really make C# a language I _WANT_ to code in. And that's from a usually mainly Linux guy who mostly codes in C, Python, JavaScript and Rust, and usually only C# at internships.
@vector_____
@vector_____ 5 жыл бұрын
Great new features Mads, all of it is stuff I've always wanted. Keep elevating C# to new levels and bringing us more awesome stuff to play with.
@metorical
@metorical 5 жыл бұрын
Very good explanation of the new language features. Thanks for the video!
@bertye
@bertye 5 жыл бұрын
Wow! These are awesome additions. I like the way C# is going!
@hssjohng8662
@hssjohng8662 5 жыл бұрын
Implicitly typed new-expressions. Best damn thing for sure, THANK YOU
@ReuelRamos
@ReuelRamos 5 жыл бұрын
The only thing that I am not comfortable yet it with the 'Default Interface Members'. If you give a body to the interface, now it is no longer an interface, but sort of an abstract class having the new members implemented and the old ones as abstract members (sorta!). I am still trying to convince my self that it is a good idea.
@mykilpee
@mykilpee 5 жыл бұрын
The Case Expressions are awesome!
@alexwilli
@alexwilli 5 жыл бұрын
C dev here to admit that C# makes me swoon.
@nabeelkhan2632
@nabeelkhan2632 4 жыл бұрын
C developers are the real programmer.
@Arhnuld
@Arhnuld 5 жыл бұрын
Great video! Thanks! That syntax is added to make some things just a little simpler makes me wonder if C# isn't just done now. I feel like it is the best language already as it is now and that you can still come up with new cool stuff amazes me.. Perhaps all these small things will make programming more difficult because there's more to learn for beginners to understand existing code. Am I getting old? Lol. Is there any big stuff coming in the future?
5 жыл бұрын
Amazing job. You are tracking and learning from new languages.
@madstorgersen7881
@madstorgersen7881 5 жыл бұрын
We try. :-)
@yamazakialex2307
@yamazakialex2307 5 жыл бұрын
I love how C# is getting better and better every year!
@markokrstic3164
@markokrstic3164 5 жыл бұрын
I really like those changes in foreach loop, makes life easier.
@prostra_ganesha
@prostra_ganesha 5 жыл бұрын
Nice, recuresive patterns and switch expressions looks cool and reminds me about Rust's pattern matching.
5 жыл бұрын
Interesting features. Thank you.
@Ziretech
@Ziretech 5 жыл бұрын
I really don't like the new default interface implementation feature. Feels like it will be misused by some. Probably in a project I will have to maintain in the future...
@SJ-ds8lp
@SJ-ds8lp 5 жыл бұрын
Some things I would like: * Inline classes (like kotlin) * readonly ref struct as default (the number of hoops I have to go through to get a safe, immutable and performant type is horrendous) * immutable as default, maybe introduce a new declaration for immutable variable: immut a = 10? And all recursive immutableness should follow through, like rust. * numeric generics * traits (default interface with operator overloading)
@TheCaptainPorkchop
@TheCaptainPorkchop 5 жыл бұрын
I would expect more dare from a new major version of a language. I stand amazed by the awesome simplicity of Go language. C# could learn a thing or two.
@thomasanderson1416
@thomasanderson1416 5 жыл бұрын
Can someone explain to me why not write instead : return switch (p. FirstName, p. MiddleName, p. LastName) { ... } Sounds more intuitive to me.
@EthimjosVelo
@EthimjosVelo 5 жыл бұрын
"switch" is a statement and not a function, and so it cannot return any value. The return statement requires for the value that will be returned to be explicitly specified, stored in a variable or returned by another function. Your way of writing the recursive pattern is similar to a function call while the presented way is similar to an anonymous function with a switch statement inside it. If you use it like that, it would be very easy to confuse the switch statement with a function.
@TraxxStudios
@TraxxStudios 5 жыл бұрын
Awesome work Mads!
@jmacdono
@jmacdono 5 жыл бұрын
Nice MONITOR bro. Good presentation too
@shouvikroy4685
@shouvikroy4685 5 жыл бұрын
Happy to see these features in C# ...these have been present in Scala long long back...I'm happy for both the languages boasting these
@sanjaythorat8521
@sanjaythorat8521 5 жыл бұрын
Thank you Microsoft. You guys are keeping us busy to learn new things and adding values to this technology world.
@superpcstation
@superpcstation 5 жыл бұрын
OMG MADS I'm so excited!!!
@madstorgersen7881
@madstorgersen7881 5 жыл бұрын
Me too!
@vkg.codefactory
@vkg.codefactory 5 жыл бұрын
I personally like default interface member, it is useful for many of my use cases, thanks Mads for the sneak peak of VS2019
@alinawaz4034
@alinawaz4034 5 жыл бұрын
i can easily say the best language of this time!!
@huwang102
@huwang102 5 жыл бұрын
@Solve Everything dotnet core?
@drewfleming1
@drewfleming1 5 жыл бұрын
Awesome features!
@EricSundquistKC
@EricSundquistKC 5 жыл бұрын
Love the AsyncEnumerables! C# has Observables now.
@pranayamr
@pranayamr 5 жыл бұрын
I think last feature of interface break ISP principle , i think there is no need to add method body in interface
@vitaliiyarema
@vitaliiyarema 5 жыл бұрын
From .NET 4.6 version you (Microsoft) are reading my thoughts. When I think It would be nice to improve coding in this part, you do it the next version. Thank you for your work.
@eriknystrom9293
@eriknystrom9293 5 жыл бұрын
Some great things. Really looking forward to the nullable reference types. This is an amazing thing that has been missing from the mainstream OO languages. Especially like the subtle yet clear and consistent syntax. I almost want it to give errors instead of warnings. Almost.
@oathwine
@oathwine 5 жыл бұрын
Some of the other languages have added the Maybe monad to their standard library. E.g. Option/Optional in Java/Scala. One advantage with this is that you can view e.g. Option as a container with zero or one elements. This means that you can use a nice linq-like chain expression on your optional instead of multiple if-statements that all check if the intermediate result is not null. Another advantage is that it is just a generic class that behaves like everything else in the type system, and not some special syntax or built-in feature in the language that complicates the language unnecessarily.
@setsunaes
@setsunaes 5 жыл бұрын
C# just keeps getting better and better. I'm very interested in Async streams. I have had recently developed something very similar to the example and it was a pain in the arse.
@shaunsales8313
@shaunsales8313 5 жыл бұрын
Mostly watched this because it's a joy listening to Mads talk about C#. Appreciate the adoption of more functional-style expressions. However, I'm curious what the C# team thinks about Data Oriented Design, as a game developer it's a big part of how we architect large titles.
@rudreshgp
@rudreshgp 5 жыл бұрын
3 dislikes from #JAVA people. I can understand your pain java people..
@ACogloc
@ACogloc 5 жыл бұрын
Eh, we've got Kotlin.
@you0neville0tube
@you0neville0tube 5 жыл бұрын
​@@ACogloc yes java got a bunch of stuff from c# :D
@Grimlock1979
@Grimlock1979 5 жыл бұрын
They're finally getting local variable type inference...
@TheAndreArtus
@TheAndreArtus 5 жыл бұрын
@@ACogloc, Yes, Kotlin has these features for a while now, but so does F#. I use many different languages (for fun and profit) incl. Kotlin+Java and C#+F#; it's a good time to be a programmer. Maybe someone out there is having fun with Java, who knows?
@wil-fri
@wil-fri 5 жыл бұрын
@@TheAndreArtus C#, PHP, Java, C++, javascript, and I know VB
@RobertMulderNL
@RobertMulderNL 5 жыл бұрын
We need a poster with all these improvements (preferably one that goes back to the older C# versions too)
@madstorgersen7881
@madstorgersen7881 5 жыл бұрын
Are you signing up to make one? :-D
@nmarcel
@nmarcel 5 жыл бұрын
C# is the best hybrid language ever! Not only for its features and evolution, but also for its ecosystem of .NET (both, Framework and Core), IDE, tools, libraries and community. Plus, now we can have it running on the browser with WASM+Mono. COOL!! ...and thanks Mads, Anders, Dustin, Eric, Gafter, and all the other people that together created this masterpiece!
@user-28492b
@user-28492b 5 жыл бұрын
Check WebAssembly: Blazor
@INFEL8
@INFEL8 5 жыл бұрын
Hm... Interface can has methods now... (it it possible and in old versions with IL, but not easy) What general difference between interface and abstract class now? (except multi inheritance)
@henke37
@henke37 5 жыл бұрын
"Default interface members" You are so close to real multiple inherence. Don't chicken out now!
@St4rdog
@St4rdog 4 жыл бұрын
That's hilarious. I was just reading about Lua mixins and was wishing C# had them...
@RD-el1io
@RD-el1io 5 жыл бұрын
I see the C# switch is finally catching up to the PowerShell switch and gaining ground on the match statement from F# :)
@ancientelevator9
@ancientelevator9 5 жыл бұрын
I love the switch expressions
@Nobo_On_The_Rocks
@Nobo_On_The_Rocks 5 жыл бұрын
Default interface members looks and feels like abstract implementation , just a bit cleaner. Can someone explain why we broke the pattern?
@MiningForPies
@MiningForPies 5 жыл бұрын
Don't forget if you don't like a feature (like default implementation in an interface) then you don't have to use it. Been developing C# apps since 2006 and I've very rarely used abstract classes, as they're not something I like tying myself to.
@2Fast4Mellow
@2Fast4Mellow 5 жыл бұрын
That only works if you're not part of a team! Default interface implementations are mixin of a interface and an abstract base class. It creates lazy developers and it takes away the concept of a blueprint! It is a terrible idea and I hope it can be turned off in a solution-wide manner or stop compiling when MSBuild encounters such a construct.. Changing existing interfaces should not be taking lightly. One should really reflect why such a change is necessary. Often a derived interface works just as good and otherwise you should do the work and fix the implementations that are broken by the interface change.
@MiningForPies
@MiningForPies 5 жыл бұрын
@@2Fast4Mellow I've worked in huge teams and never had an issue.
@2Fast4Mellow
@2Fast4Mellow 5 жыл бұрын
​@@MiningForPies That is probably because you are only part of a team and not managing a team. I'm a software architect and one of my job is to enforce our coding standards, rules and conventions. StyleCop(.Analyzers) have (currently) only support up to c# 7.3. So, if a new intern (which watched this episode and thinks this is a quick way to extend interfaces (we follow SOLID principles, so basically everything (even entities, but that reason lies in our MongoDB ORM) is a interface), I currently have no way of stopping him, even when the coding standards say that default interface implementations are not allowed. If you want to use the concept of default interface implementations in new code, you can define a normal interface and create a (abstract) base which marks all methods and properties as abstract. Need to be implemented explicitly by every concrete implementation. Than when you introduce a new method to the interface, you can add a virtual method to the base class and all implementations that inherit from that base class will have that default implementation. Concrete classes that implement the interface, but not inherit from the base class will still break. Sounds very much like the concept of a default interface implementation. Except that if I create a new concrete implementation of the interface, it is MY decision to inherit from the base class. However, when I choose NOT to use the base class, the developer that made the interface change, will need to consult with the authors of the broken implementations, if the implementation in the base class can be copied to the broken implementation. C# will not suddenly 'add' a default implementation to my class. This is a very important architectural standpoint.. But I'm sure that once C# 8 is officially released, StyleCop gets an update as well, so I can enforce that default interface implementations never makes into TFS because it is stopped by the checkin rule..
@MiningForPies
@MiningForPies 5 жыл бұрын
@@2Fast4Mellow tools like style cop should never, ever, replace proper peer reviews. It sounds like a nightmare forcing everything to be an interface.
@2Fast4Mellow
@2Fast4Mellow 5 жыл бұрын
You can't everything peer review. Well, you can, but than you won't make your deadlines. Style cop is a very good solution to enforce coding standards, rules and conventions. It is very simple, if you can't commit (or shelve) a default interface implementation to TFS, there is also no need for a peer review! Do you have any idea how much time this saves? Also peer reviews usually examine the requested feature, they spend almost no time checking if you did follow all the coding standards, rules and conventions.. We have written our own ORM toolkit. Let's say you have a product entity. Magento requires different fields than Prestashop, Amazon or SalesForce. So, we have a 'base' order entity and each shop specific implementation add it own fields. So you have a Product, MagentoProduct and AmazonProduct entity. So why the interfaces. Converting product into AmazonProduct and MagentoProduct is very resource intensive because of the casting to concrete types. That is why we use interface entities. So, you also have IProduct, IAmazonProduct and IMagentoProduct interfaces. With the use of the reflection magic we're able to dynamicly create a 'super' entity that implicit implement IProduct and explicitly implement the addon product interfaces. This super entity has all three implementations, so passing the super entity as IMagentoProduct or IAmazonProduct is possible without casting. You don't get passed a AmazonProduct anymore. Within product document each addon has it's own section addon_{addonid}_{entityname}. The super entities than for example has a property Addon_{addonid}_amazon_product_sku which explicit implements IAmazonProduct.Sku. But the same entity can also hold a Addon_{addonid}_Magento_product_sku which implements IMagentoProduct.Sku. Developers don't have to create these super entities. The system does that for them, but because you don't get your original interface implementation passed to your addon, you need to use the entity interface. Also the 'I' from SOLID stands for Interface Segregation Principle which states that you should only program against interfaces. Interfaces are also very easy to mock and fake and that makes unit testing a breeze.. SpecFlow is used to 'prove' to the customer the code is working as described (not as hoped). That is next to the regression tests and e2e intergration tests. Writing code is at max 25% of the time spend by a developer. Writing unit tests takes at least as much time writing. Than you get the BDD and E2E tests, updating documentation, manual testing and communication (with team members or stake holders). Remember done is done. For example when we need to asses how much time developing a certain feature costs, we simply multiply the 'raw' development time by six. The first four multiplications are for the development team, the 5th for the account manager and the 6th is basically spare time. When your 3 days late, the customer is mad. When you're 3 days early, the customer throws you a parade.. We like parades!
@JohannS2969
@JohannS2969 5 жыл бұрын
thumbs up for switch expressions! yes please.
@frankszendzielarz6350
@frankszendzielarz6350 5 жыл бұрын
Very nice summary. One or two questions: this might be a bit of a philosophical can of worms, but what conceptually is the difference between the behaviors IAsyncEnumerable and IObservable? My view is that the "Enumerable" part is synonymous with "Iterable," but the async part simply means 'iterate when notified.' To my mind this is the same as an IObservable with one subscriber. Do IAsyncEnumerables allow multiple subscribers in some syntactically transparent way?
@sacation6057
@sacation6057 5 жыл бұрын
Awesome features! The nullable feature will be a pretty usefull tool to improve maintainability of the codebase, and i feel like c# is closely looking to languages such as python, looking at the improved tuples vrom c#7, and the index slicing of c#8 now. I love it! Even though i'm not a big microsoft fan, i love the .NET CORE abd c# projects, and i believe that they both have a very bright future seeing the awesome changes of last years.
@Astrosisphere
@Astrosisphere 3 жыл бұрын
One I'd like to see is automatic assignment constructors for immutable types. Ideally something that would generate the Equals and GetHashCode overrides for a struct too. Right now the best way I've found of doing this is writing a T4 template for each struct and calling code to generate it based on the properties you want. I might go one step further and create something like an EDMX file to generate T4s to generate the structs but I have a feeling that by the time I've done this, it will already have its own syntactic sugar!
@marc2377
@marc2377 5 жыл бұрын
What a time to be alive.
@cionsoc
@cionsoc 5 жыл бұрын
Async streams is going to be great. Been waiting for this for years.
@TarikGuney
@TarikGuney 5 жыл бұрын
It would be nice to add extension methods to the interfaces that are inherited by their concrete classes.
@greenlight2k
@greenlight2k 5 жыл бұрын
About the interface body: How is the implementer informed about that new member? I guess with a colorized compiler warning or such?
@imgenus
@imgenus 5 жыл бұрын
All these are nice. One thing I really want is making `new` keyword optional, like what Dart did
@ChandanSatapathi
@ChandanSatapathi 5 жыл бұрын
Slicing was really cool!
@anders1245
@anders1245 5 жыл бұрын
I understand why people who work in C# and .NET all the time are grateful for time-saving features. But for someone like me who only works with them on occasion, the extra functionality has been decreasing the language's readability and increasing the learning curve. I can write programs in C# because the fundamentals of the language are the same as other OOP languages that I use all the time. But I wouldn't feel comfortable interviewing for a job as a C# developer even though I've written the back end for my personal web apps with C# and ASP.NET (which in itself changes rapidly). It's very much a skill that if you don't work with it regularly, you fall behind because of how quickly it advances. I appreciate the power of the framework, but I have to consider my employment viability when picking technologies to use in my projects. And because my projects are desktop-style web applications that are 95% front-end work, I'll never be able to devote the steady time to C# and ASP.NET it takes to maintain marketable skills. Anyway, you guys are clearly doing great work. I just wish it was something I could justify investing my time in.
@kevincharest1695
@kevincharest1695 5 жыл бұрын
Is the addition of the await foreach supposed to basically replace BlockingCollection completely or is there something I am missing here ? Is there a situation where one would be used instead of the other ?
@NavedRasul
@NavedRasul 5 жыл бұрын
nice upgrades! 👍
@Avisinna
@Avisinna 5 жыл бұрын
Some good work C# 8.0 is looking like Swift# :)
@MsKarlason
@MsKarlason 5 жыл бұрын
OMG! It's wonderful!
@bfdes8485
@bfdes8485 5 жыл бұрын
Great new additions. But one thing I really wish C# would get is a robust Option type.
@dotnetdevni
@dotnetdevni 5 жыл бұрын
I can’t wait till see what open source does for win forms.
@WolfersHD
@WolfersHD 5 жыл бұрын
I don't even use C# anymore but like watching these because they're always done so well. Microsoft has become my favorite company and I really hope they keep doing the amazing job they've done over the last 5 years.
@carrott741
@carrott741 5 жыл бұрын
Microsoft? Your favorite company? You poor, uninformed man...
@WolfersHD
@WolfersHD 5 жыл бұрын
@@carrott741 They are the tech giant I have the most favorable impression of, favorite company was the wrong words.
@carrott741
@carrott741 5 жыл бұрын
@@WolfersHD I see.
@kazeryuu3603
@kazeryuu3603 5 жыл бұрын
This language only gets better!
@Haryyyy
@Haryyyy 5 жыл бұрын
This is cool! Thanks! :)
@ruthuplol
@ruthuplol 5 жыл бұрын
For the switch statements, what about numbers? switch (int i, int j, int k) { {0, >0} => Log("all positive"); default: Log("default"); }
@zangetsu2k8
@zangetsu2k8 5 жыл бұрын
Can you make it possible to print which variable is null when you get that exception? would save a lot of time when debugging.
@krm1t
@krm1t 5 жыл бұрын
I understand why they choose to make the nullable reference types feature a thing that must be enabled - I generally like opt in stuff. But personally i would have liked this one to be the other way around. When creating a new project i have to enable a feature that (at least to me) makes sense to always have enabled - That seems wrong. If it was the other way around then when upgrading i suddenly get a lot of warnings (remember your code will still compile and run) I can then choose to say i don't care and opt out of the feature to remove the warnings.
@irwtla1
@irwtla1 5 жыл бұрын
You could just add that compiler directive to your c# class template so every class you create has it regardless of the project settings.
@krm1t
@krm1t 5 жыл бұрын
@@irwtla1 Thanks for the workaround but not really where i was going with my message :)
@madstorgersen7881
@madstorgersen7881 5 жыл бұрын
I think we should probably have it on by default in new C# 8.0 projects. But people open and upgrade existing projects for many reasons, and many have "warn as error" on. We just can't break those scenarios. Maybe we can give an informational message telling them how many warnings they would get if they turn it on! :-D (only half joking)
@SimonBuchanNz
@SimonBuchanNz 5 жыл бұрын
@@madstorgersen7881 "CS4000: Not all warnings enabled"
@christobanistan8887
@christobanistan8887 5 жыл бұрын
A lot of the time non-nullable refs mean more code. I don't like them much since I am a careful programmer and I don't get null refs much.
@johnernest8109
@johnernest8109 5 жыл бұрын
Switch expressions are an amazingly welcome addition, I can think of a ton of situations in the past where it would have been very helpful. C# as a language is top notch, it's been my go to language for about 90% or so of my projects since 2003, as much as I can. Now if only the rest of the .NET ecosystem can catch up, there are a few gaps to close out there in the .NET Core world revolving around Roslyn Code Analysis, DLL unloading at runtime, and so on, some gaps over especially in the Unity3D world, of course that one's 3rd party, but I would really like to see Microsoft implement something 3D on the scale of Unity for serious app development as a replacement to UWP for heavier cross-platform UIs, since I'm constantly between my Windows desktop and a MacBook. I actually use Unity for mathematics in linear algebra, calculus, and trig, better than Matlab but requires reinventing a lot of wheels and Unity's UI is primitive compared to UWP XAML, plus they don't follow best practices in a lot of areas, last I checked even though they implemented System.Threading.Tasks.Task they didn't implement a way to dispatch on the UI thread. VS for Mac has got a bit of catching up to do in the OSX world, but actually not bad. I spent a tad bit of time in Python, and found that even though I didn't like a lot of things about Python or some of the development communities involved with it, they had some good iterators and data types that I thought would be useful in C#. Seeing array slicing on the horizon makes me feel at home a bit more.
@AlbertoChirinosNET
@AlbertoChirinosNET 5 жыл бұрын
Thank you!
@koszeggy
@koszeggy 5 жыл бұрын
Ok so now the IEnumerable interface can finally be fixed by adding a CanReset property. Not as if Reset was a useful something but starting with C# 2.0 iterators it became completely useless as it was no way to query if it was implemented.
@weirdwordcombo
@weirdwordcombo 5 жыл бұрын
Nice now I can use in C# what I already used in TypeScript, except C# actually has things like Threads and Reflection which is much better
@anonymousmokona8541
@anonymousmokona8541 5 жыл бұрын
When are you going to implement expression-ifs? the ternary operator is barely readable :C
@maacpiash
@maacpiash 5 жыл бұрын
I'm confused with the last feature (default interface members). Why would we need the ability to add a body to a function inside an interface?
@JohnLudlow
@JohnLudlow 5 жыл бұрын
To avoid breaking things by extending the interface. Suppose you have an IPerson with FirstName and LastName, then you realise you need a MiddleName. Suddenly, anyone implementing an IPerson needs to make a change to avoid breaking their code by upgrading to the new version of your library. Of course it doesn't actually solve anything.
@madstorgersen7881
@madstorgersen7881 5 жыл бұрын
You can add a new member to the interface without breaking existing implementers.
@matthew4497
@matthew4497 5 жыл бұрын
@@madstorgersen7881 Will we be able to search for all "implied" usages of these? So, using the logging example, will I be able to search for occurrences of "Log(Exception)" where it wasn't implemented, but where I might want to implement it piecemeal?
@Grimlock1979
@Grimlock1979 5 жыл бұрын
Wasn't a big reason for having it interop with other languages/frameworks?
@beButters
@beButters 5 жыл бұрын
White background..... Triggered!!!!!!
@BGraves
@BGraves 5 жыл бұрын
I know dude... you gotta have that black screen in a dark room while techno plays and you recline in a layback hacker chair with ceiling suspended monitors while matrix plays on the second monitor yelling "I'm in!" every time you run a debug
@janbodnar7815
@janbodnar7815 5 жыл бұрын
Great features! How about pure functions (not methods) and non-static main method? These are real pain.
@ScottieSLG
@ScottieSLG 5 жыл бұрын
I always just use (p.MiddleName ?? string.Empty). Works perfectly and way less code.
@Gunnerpunk
@Gunnerpunk 5 жыл бұрын
Only problem with that in this case would be that if there was no middle name, you wouldn't want to include the extra period and space. So I would do something like (p.MiddleName != null ? p.MiddleName + ". " : string.Empty)
@viniciusvbf22
@viniciusvbf22 5 жыл бұрын
Actually, it won't work in the given example - first char of MiddleName followed by "." = MiddleName[0] + ".".
@rafaelvascc
@rafaelvascc 5 жыл бұрын
@@Gunnerpunk (p?.MiddleName ?? string.Empty) EDIT: Ah sorry, i misunderstood your question. Still, we need to check if p isn´t null somehow.
@The_TermiGator
@The_TermiGator 5 жыл бұрын
switch expressions!! awesome!
@MustaphaCM
@MustaphaCM 5 жыл бұрын
C# my favourite programming language look for new updates and some usefull tips
@2Fast4Mellow
@2Fast4Mellow Жыл бұрын
Ironically the code can still produce a array out of bounds exception when MiddleName is 'String.Empty'. Therefor the code should check for String.IsNullOrWhitespace or even better if length is greater than zero instead of just null...
@JosephCatrambone
@JosephCatrambone 5 жыл бұрын
It looks like Kotlin! :D No disrespect. I think that's a good indicator that we're converging on good ideas.
@keweiwang1449
@keweiwang1449 4 жыл бұрын
The Language extension part is really like λaskell
@vrn11
@vrn11 5 жыл бұрын
All is good but I have a bad feeling about method body in interfaces. Didn't abstract people complain?
@byte2702
@byte2702 4 жыл бұрын
I still have to smile about „string?“. The meaning of it is very clear here. But in other programming languages like Java they would wonder a lot.
@mukundhbhushan6709
@mukundhbhushan6709 5 жыл бұрын
this is just great
@lionkor98
@lionkor98 5 жыл бұрын
Just amazing. I'm so disappointed that my University is teaching us Java (and old java at that), instead of this language. This will become the industry standard as soon as we have a reliable and nice x-platform .NET Standard, it will very likely replace C++ and Java in many application cases. It's slicker than anything I know, great job, and please keep this going. Also great to see you actually interacting with the community.
@Scott_Stone
@Scott_Stone 5 жыл бұрын
Are you from India?
What's new in C# 8 - Part 1
23:48
Microsoft Visual Studio
Рет қаралды 80 М.
The Right Way to Check for Null in C#
9:35
Nick Chapsas
Рет қаралды 94 М.
Её Старший Брат Настоящий Джентельмен ❤️
00:18
Глеб Рандалайнен
Рет қаралды 7 МЛН
В ДЕТСТВЕ СТРОИШЬ ДОМ ПОД СТОЛОМ
00:17
SIDELNIKOVVV
Рет қаралды 3,8 МЛН
TRY NOT TO LAUGH 😂
00:56
Feinxy
Рет қаралды 10 МЛН
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1 МЛН
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 746 М.
What are record types in C# and how they ACTUALLY work
15:36
Nick Chapsas
Рет қаралды 117 М.
5 New Features in C# 9 (not including Records)
1:11:00
IAmTimCorey
Рет қаралды 80 М.
Every single feature added in C# 11
27:07
Nick Chapsas
Рет қаралды 110 М.
What's new in C# 10
29:28
dotnet
Рет қаралды 86 М.
Correcting Common Async/Await Mistakes in .NET - Brandon Minnick
1:00:11
NDC Conferences
Рет қаралды 166 М.
Samsung S24 Ultra professional shooting kit #shorts
0:12
Photographer Army
Рет қаралды 10 МЛН
ПОКУПКА ТЕЛЕФОНА С АВИТО?🤭
1:00
Корнеич
Рет қаралды 631 М.
Best Beast Sounds Handsfree For Multi Phone
0:42
MUN HD
Рет қаралды 340 М.
Mem VPN - в Apple Store
0:30
AndroHack
Рет қаралды 71 М.
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 5 МЛН