Every feature added in C# 10 with examples

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ก.ค. 2024
  • Become a Patreon and get source code access: / nickchapsas
    Check out my courses: dometrain.com
    Keep coding merch: keepcoding.shop
    Hello everybody I'm Nick and in this videoI will show you every single feature added in C# 10.
    AsyncMethodBuilder example: gist.github.com/Horusiath/401...
    Timestamp:
    Intro - 0:00
    Global using statements - 0:17
    File scoped namespaces - 2:30
    Constant interpolated strings - 3:37
    Attributes support generics - 4:37
    Lambda improvements - 5:31
    Extended property patterns - 7:20
    Record structs - 8:35
    Record types can seal ToString() - 9:53
    Structure type improvements - 10:48
    Assignment and declaration in the same deconstruction - 11:53
    Allow AsyncMethodBuilder on async methods - 13:05
    Static abstract members in interfaces - 14:19
    Don't forget to comment, like and subscribe :)
    Social Media:
    Follow me on GitHub: bit.ly/ChapsasGitHub
    Follow me on Twitter: bit.ly/ChapsasTwitter
    Connect on LinkedIn: bit.ly/ChapsasLinkedIn
    #csharp #dotnet #csharp10

ความคิดเห็น • 167

  • @nickchapsas
    @nickchapsas  2 ปีที่แล้ว +37

    Thank you so much everyone for pointing out usecases for static abstract members in interfaces. No idea how I missed it, since it's quite obvious but I'm so glad you could give me a hand wiht this one!

    • @talwald1680
      @talwald1680 2 ปีที่แล้ว +1

      Async method builder allows to specify how to configure the state machine of the async method behind the scenes. Look at Microsoft's RC post - they show an example where they pool the task instances and improve the performance.
      About static members in interfaces - a lot of code in functional programming is repeated because there is no way to look at the shape of the type - including static members.
      Implementing map, reduce and filter is a great example, because the implementation of map on a collection, and on tasks, and async enumerables and option and more are pretty much the same, and the duplicate code can be totally eliminated with abstract members in interfaces.
      I recommend you look it up.
      Great video! I'm supper excited to use this in my own projects!!

    • @DeathxStrike18
      @DeathxStrike18 2 ปีที่แล้ว

      The lambda with var = null causes an error because var could be a bool as there isnt a type to clarify to the compiler and bools can't be null they are binary. so by clarifyhing string before the lambda your telling that Var represents a string and only a string. Though honestly var should probably not be used as it leads to hard to read code the exception is where the type is clear such as var counter = 1 in this case its easy to tell its an int.

  • @Krzysztof20031997
    @Krzysztof20031997 2 ปีที่แล้ว +18

    I love it that you if you don't know a mechanism you just say "I don't know it, but just wanted to tell you that something will be changed."! Thank you for presenting C# 10 features in this nutshell :)

  • @victorvandermilte5857
    @victorvandermilte5857 2 ปีที่แล้ว +6

    So happy about the static abstract members. This is something that has been bugging me for years. I have needed this feature many times and no language ever seemed to have it.
    Without this functionality, if you want a class family to have common fields with hardcoded values, but with different values for each subclass, you have to instantiate the class before you can access the hardcoded fields. Now you can just call it statically from the subclass. I feel like I often want this functionality when associating enums with subclasses. You can also enforce singletons in a class hierarchy with this.

  • @valcron-1000
    @valcron-1000 2 ปีที่แล้ว +43

    Static abstract members are Typeclasses from Haskell. When implementing an interface you need to extend from it in the class declaration (class X : Interface { }), but with this new feature you can extend classes which you don't control (like extension methods, but in a controlled manner). This goes WAY beyond "numerical" code.
    For example, a while ago I was working on an Android project that used the class "MediaMetadataRetriever". In order to use the "try-with-resources" construct, a class should implement the "AutoClosable" interface. The class didn't implement the interface until API 29. Even if the class conformed to the interface and I could recreate the behavior using it's public API the only option I had was to make a subclass that implements it. With Typeclasses I could easily extend the interface without needing to control the class implementation.
    I recommend watching this video from Mads Torgersen: th-cam.com/video/hnu_EgFLO7g/w-d-xo.html

    • @callindrill
      @callindrill 2 ปีที่แล้ว +1

      Thanks. This was a great resource for learning about this feature!

    • @dcuccia
      @dcuccia 2 ปีที่แล้ว +3

      I'd simply describe it as "inheritance-free contracts for static members." I will use this all over the place when swapping implementations of functions that don't need an instance, such as a configuration driven "option" or a fake for testing.

    • @ZipADeeeDoooDaaa
      @ZipADeeeDoooDaaa 2 ปีที่แล้ว +1

      Thank you so much. If it wasn't for your comment, I wouldn't have realized that this is the very feature I was hoping, waiting and searching for since c# 4.0. Every now and then i would look at the feature list and hope they implement something close to the golang interface mechanism. Finally it is here. :D

    • @ZipADeeeDoooDaaa
      @ZipADeeeDoooDaaa 2 ปีที่แล้ว +1

      After I played around with this feature, I sadly have to report that it is not there yet. There is one key thing missing to resemble Typeclasses from Haskell or interfaces from golang. For now there is no way to link the interface to an existing class ( e.g. extension IntExt : Int32, INumber { } ).
      So back to square one for me :(. I hope it will not take another 5+ years to get implemented.

    • @jfpinero
      @jfpinero 2 ปีที่แล้ว

      @@ZipADeeeDoooDaaa Just curious, why can't you create a class and derive it from Int32? If you need a new method in that class, why not create an extension method?

  • @lahcencodery
    @lahcencodery 2 ปีที่แล้ว +2

    I've been coding in Typescript only for the last 6 months, came here to check on my favortie language and your video made me keen to get back to C#

  • @petrusion2827
    @petrusion2827 2 ปีที่แล้ว

    The last one is so amazing!! I've been waiting for something like this to be added, I'm seriously excited for this! It easily outshines the other changes, even though it is still in preview. The *with* keyword on structs as well as record structs are a close second - I already knew about those, but finding out we are getting what is pretty much Typeclasses has just really made my day, can't wait!

  • @RoughSubset
    @RoughSubset 2 ปีที่แล้ว +49

    Unless I've missed it in your videos, a video on Func and Action with practical use cases would also be great!

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว +49

      I have a video exactly like that scheduled within the next 2 weeks

    • @RoughSubset
      @RoughSubset 2 ปีที่แล้ว +2

      @@nickchapsas Awesome, thank you!

    • @sallerc
      @sallerc ปีที่แล้ว

      @@nickchapsas What is the name of the video? Couldn't find it when searching through you videos

  • @SPL1NTER_SE
    @SPL1NTER_SE 2 ปีที่แล้ว

    They did some really nice work on this version of C#. I particularly liked the decreased amount of nesting and clutter caused by namespaces and using statements. I feel like this is revolutionary in terms of code-overview in C#!
    Great video by the way, I subscribed!

  • @igorsentrxigorsentrx5550
    @igorsentrxigorsentrx5550 2 ปีที่แล้ว

    'AssAndDeclaration' from feature 9.
    You are a master of naming! )

  • @MaxBenn
    @MaxBenn 2 ปีที่แล้ว

    So I subscribed to many TH-camrs... You are the first one who got the Notificaton Bell... Great work! A ton of useful information in a short amount of time.

  • @longuinni
    @longuinni 2 ปีที่แล้ว

    Really great video Nick! Thanks for sharing

  • @Pedro5antos_
    @Pedro5antos_ 2 ปีที่แล้ว

    Great language improvements!
    And great videos as always, Nick

  • @janbodnar7815
    @janbodnar7815 2 ปีที่แล้ว +25

    For me, the file scoped namespaces, global usings & lambda improvements are the greatest additions to the language. The only thing that Java language had better than C# was the package system; now with file scoped namespaces, I declare the Java language officially defeated. Everywhere, the C# syntax is now cleaner, shorter & more powerful. (Note that this is relevant to the Java as the language, the ecosystem has Clojure & Groovy languages which are both great.)

    • @TodorKatsarski
      @TodorKatsarski 2 ปีที่แล้ว +2

      and Java still doesn't have async / await in 2021

    • @11clocky
      @11clocky 2 ปีที่แล้ว

      Java has better enums, though.

    • @pemifo260
      @pemifo260 ปีที่แล้ว

      @@11clocky who uses enums?

    • @11clocky
      @11clocky ปีที่แล้ว

      @@pemifo260 I use them all the time. They are much better at representing a state than an int.

    • @pemifo260
      @pemifo260 ปีที่แล้ว

      @@11clocky can you provide some examples? yes i agree with you enums represent states better than int but in my codes i don't represent states that much (likely never to rare.)

  • @dmytroshchotkin2939
    @dmytroshchotkin2939 2 ปีที่แล้ว

    Thanks a lot, Nick! A very nice overview.

  • @evanboltsis
    @evanboltsis 2 ปีที่แล้ว

    Great content as always! Thanks Nick.

  • @maskettaman1488
    @maskettaman1488 2 ปีที่แล้ว +1

    Incredible video. I was looking for something exactly like this

  • @mosth8ed
    @mosth8ed 2 ปีที่แล้ว +1

    The abstract members in an interface, I was just wishing the other day I could do that in a game I have been working on. Nice to see that I will soon be able to. 👍

  • @hoej
    @hoej 2 ปีที่แล้ว

    Great video! My favourite is Filescode namespaces, it'll just make every day work so much nicer.
    A quick tip on VS and SMSS (and some other editors/IDEs that want the same keybindings): Ctrl+K, C comments code (line if nothing is marked, marked code otherwise), Ctrl+K, U uncomments code (active cursor location and out).

  • @moe4b
    @moe4b 2 ปีที่แล้ว +1

    Been waiting on generic attributes for sometime; good to see it implemented, now hoping for static indexers

  • @VandroiyIII
    @VandroiyIII 2 ปีที่แล้ว +1

    I'm happy to see F# features still flowing to C# by the bucket. Can't wait to have them back while working with C#. :)
    Static abstract might even be better in some cases than the explicit inlining chaos F# has been using.
    Now do type providers and tail recursion and units of measure. lol

  • @kerverse
    @kerverse 2 ปีที่แล้ว

    Man! I Wish I knew your channel earlier amazing presentation and production quality
    you deserve many more subs bro!
    keep it up!

  • @TrowGundam
    @TrowGundam 2 ปีที่แล้ว +26

    I'm disappointed the "field" keyword for properties didn't make the cut for C# 10. It would have let me get rid of so much cookie cutter code when I work WPF.

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว +5

      Same goes for the required keyword :(

    • @jankalfus42
      @jankalfus42 2 ปีที่แล้ว +7

      Microsoft doesn't care about WPF. Sad, but true.

    • @jfpinero
      @jfpinero 2 ปีที่แล้ว

      @@jankalfus42 Blazor WPF, Maui in .NET 6, do they really not care about WPF???

    • @infeltk
      @infeltk 2 ปีที่แล้ว

      @@jankalfus42 And what instead?

    • @mariocamspam72
      @mariocamspam72 ปีที่แล้ว

      @@jfpinero They really don't. WPF has been practically abandoned by MS, only receiving small patches from the **community**. The tooling is gradually becoming more broken as we get more awesome helper packages and complex functionality

  • @ajonescouk
    @ajonescouk 2 ปีที่แล้ว

    Great video as always and thank you. Just taking some time to blow some smoke up your backside: it's really refreshing to hear on the last point, "I can't think of a use for this let me know if you can..." it's the tendency of a lot of big programming YTers to be incredibly patronising and thinking they have to know everything. I'm only amateur but find a lot of channels talk down to their viewers even on complex subjects. Your approach is much more level-headed and you don't talk down to your viewers which I appreciate and will cause me to continue watching and staying subbed. Cheers.

  • @mohammadjaber3898
    @mohammadjaber3898 2 ปีที่แล้ว

    As usual, Great explanation 👍

  • @smithjohnson2709
    @smithjohnson2709 2 ปีที่แล้ว

    You are amazing, thank you for your time and great explanation!!!

  • @joetrueman3555
    @joetrueman3555 2 ปีที่แล้ว

    “Intendation”? ;)
    Great and informative vid, Nick… I watch every one of your videos … keep up the great work! :)

  • @Fiilis1
    @Fiilis1 2 ปีที่แล้ว

    Man this youtube surfing is full of mystery, first I am watching diaper fashion video and next I am watching coding. I'll keep going, wonder where I end from here.

  • @SecondFinale
    @SecondFinale ปีที่แล้ว +1

    File scoped classes would also be great, possibly that get class name from file name.

  • @AndrzejPauli
    @AndrzejPauli 2 ปีที่แล้ว

    OMG, C# 9/10 is sooo similar to modern javascript :-) Loving it!!!
    BTW, great material Nick

  • @sindiinbonnienclyde
    @sindiinbonnienclyde 2 ปีที่แล้ว

    Excellent video, thank you.

  • @jors3028
    @jors3028 2 ปีที่แล้ว +1

    C# 10 has really great code-reducing features, however, the static abstract members feature ups the game. Yes, it does allow for something like strong units does in F#, however, it also gives you a way to implement a Factory Pattern without having to declare a separate class. This means, one less level of complexity, and factories really make it easier to use immutable types, which means less bugs and easier-to-use libraries.

  • @mikolajsemeniuk8574
    @mikolajsemeniuk8574 2 ปีที่แล้ว

    Great video, keep going.

  • @bezimienny5
    @bezimienny5 2 ปีที่แล้ว

    You missed the perfectly valid opportunity to make "C# 10 features in 10 second" video ;D

  • @easycodeunity3d14
    @easycodeunity3d14 2 ปีที่แล้ว

    Thank you very much!

  • @paulecampbell
    @paulecampbell 2 ปีที่แล้ว +1

    Nick you the boss!!! You're videos are hands down the best! Please consider creating some Pluralsight or Udemy courses. They would "sell off" as we'd say here in Jamaica.

  • @willinton06
    @willinton06 2 ปีที่แล้ว +5

    Nick I’m sure you have seen cases where abstract members in interfaces would be useful, maybe in an async creation pattern? As in, a class that requires some async behavior to be initialized, but you can’t put it in a constructor so you use a static method CreateAsync, that returns a task of the object, now that could be on an interface and mixed with generics to cleanup lots of repetitive code.
    And generic math is just cool

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว

      I would never think to put that on the interface for a couple of reasons. It is really rare that I would need some async initialization and if I ever did I would do that as part of DI.

    • @willinton06
      @willinton06 2 ปีที่แล้ว

      @@nickchapsas that’s the usual way I go for it, but in this one case I had to go for the CreateAsync pattern for a long ass reason and it would have been nice to put that behind an interface

    • @protox4
      @protox4 2 ปีที่แล้ว +1

      It's the factory pattern, where this feature is super useful! CreateAsync is just another form of the factory pattern.

  • @claudiopedalino337
    @claudiopedalino337 2 ปีที่แล้ว

    Nice overview Nick, Thanks :)
    Question: Do you try api versioning into a minimal api? is it possible?

  • @Handyzhang
    @Handyzhang 2 ปีที่แล้ว

    great sharing, save my time, thanks very much!~

  • @X39
    @X39 2 ปีที่แล้ว

    That static interface thingy is ac hellalot of awesome but only really useful whenever you work with generics. Had the need for it a lot already, love they finally added it (next please stack allocated arrays and eg. Constants as generic parameters please @c#)
    Main usecase is hard to explain until you come across that kind of nightmarish (in c# at least) usecase, having to use factory classes or reflection and extensive caching to solve
    Regarding the async method builder attribute, cannot really share anything regarding what or how it exactly works as I did not upgraded the code of that part at work yet, but it is essentially for building custom tasks (which was a nightmare in the past with loads of compiler magic functions and behavior, AFAIK that should change that), researching into it is quite likely to yield great results (eg. Got a custom promise that allows to await events that rely eg. On the user. Allows loads of way nicer code)

  • @Elite7555
    @Elite7555 2 ปีที่แล้ว

    I like the idea of global usings in the .proj file. However, I certainly don't like some random .cs file having them.
    Fibers are a really neat addition! Fibers are essentially "green threads", something like go-routines. They also work co-cooperatively; however, they aren't guaranteed to run in the same thread.
    Static abstract members are indeed very niche, and most likely they're only really useful to make overloaded operators available to generic functions. *However*, that's actually really, really neat.

  • @heischono4917
    @heischono4917 2 ปีที่แล้ว

    Thank you @Nick for all your videos. I have seen multiple videos in the last few days, and I must say: as a non-native English person, I sometimes don't understand what you say. You have an enormous speed, that surely is ok for the most of viewers. But these are "tutorials for every level", should you think about, that the entry levels perhaps have a problem with the speed of both presentation and speech? I remember one video, where you overlaid text - it was just impossible to read the text completely :( Yes, I know about a pause function, but this shouldn't be necessary.)
    Again, thank you for your work, the content is very useful!!! But I must wait to become a patreon, because I sometimes just give up ... Greetings from a German, living in Norway :)

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว +2

      Hello there 👋. If I am talking too fast then you can slow me down by using the speed playback feature. Unfortunately I don’t think that my videos are for entry level engineers but rather intermediate to advanced. The majority of the audience prefers the fast pace rather the slow one. There are other creators, like Tim Corey, that you might find easier to follow. Ultimately I am making content that I would like to watch myself. Greetings from a Greek living in London.

    • @heischono4917
      @heischono4917 2 ปีที่แล้ว

      @@nickchapsas I will give the speed playback feature a try. I know Tim Coreys videos, and there I think it is too much 'overhead', compared with your content. Something in the middle would be perfect, but as long as I haven't found 'something in the middle', I think I will prefer your videos in the most of cases 😁

    • @heischono4917
      @heischono4917 2 ปีที่แล้ว

      @@nickchapsas wrote: "Unfortunately I don’t think that my videos are for entry level engineers but rather intermediate to advanced."
      Your Patreon banner says "... tutorials for every level". 😉

  • @BlueRaja
    @BlueRaja 2 ปีที่แล้ว

    Interestingly, I suggested file-scoped namespaces (and file-scoped class declarations) 12 years ago on the old C# suggestion tracker. Their response was that this would not be a useful feature.

  • @afouadr
    @afouadr 2 ปีที่แล้ว

    Love it :-)

  • @DanielKierkegaardAndersen
    @DanielKierkegaardAndersen 2 ปีที่แล้ว

    I know a few game engine devs who were wishing for the last feature :3 (static abstract interface implementations)

  • @roblyndon5267
    @roblyndon5267 2 ปีที่แล้ว +2

    Arguably, var text = () => default(string) is more readable.

    • @DaveZeegers
      @DaveZeegers 2 ปีที่แล้ว +1

      I personally can argue that Function is way better as var. In my opinion every developer tries to be lazy. When im reading code from someone else it mostly consists of var x = "bleh". Which makes me need to think about what kind of class x is. Why not keep it type specific also in code. Everyone should stop using var if it would be up to me.
      I don't think ability using var in any situation makes it more readable or less cluttered as the author of this video explains. In my opinion these are additions for the "lazy" programmer not to define things. But make them less readable for any third party.

  • @chezchezchezchez
    @chezchezchezchez 2 ปีที่แล้ว

    Good job

  • @gideonmaxmerling204
    @gideonmaxmerling204 2 ปีที่แล้ว

    15:20
    that is literally something I have tried to do but found out I couldn't, that's kinda funny

  • @vladyslavhrehul2185
    @vladyslavhrehul2185 2 ปีที่แล้ว +12

    Nick, would you make video about structs? Should we use them or not?

    • @codex4046
      @codex4046 2 ปีที่แล้ว +9

      A video about structs, records and classes would be nice. The differences and when to use one over the other.

    • @protox4
      @protox4 2 ปีที่แล้ว

      A good rule to go by: if you're not sure if you should use a class or a struct, use a class.

  • @ghkpr
    @ghkpr 2 ปีที่แล้ว +1

    11:13 nice

  • @vintage8
    @vintage8 2 ปีที่แล้ว +2

    Really, really, nobody commented about 420 or 69 at 11:25.
    I believe even Nick kinda got upset about that.

    • @KebunH
      @KebunH 2 ปีที่แล้ว

      Oh I noticed straight away, in my work projects my unit tests are filled with these values

  • @stefanbogdanovic590
    @stefanbogdanovic590 2 ปีที่แล้ว

    Nick, can you make a video about Multithreading, locking deadlocks?

  • @sayedahmedanimation11
    @sayedahmedanimation11 2 ปีที่แล้ว

    thanks

  • @metacob
    @metacob 2 ปีที่แล้ว

    File-scoped namespaces. I can finally (and trivially) remove one indentation level in literally 99.999% of my code (and that 0.001% was just due to laziness, I can remove it there too). It's literally free (horizontal) real-estate.

  • @karlstenator
    @karlstenator 2 ปีที่แล้ว

    1:31 - hey, how did you open up the XML via Solutions Explorer?

  • @LKD70
    @LKD70 2 ปีที่แล้ว

    does VS have an option to follow a definition? For example if you were to select JsonSerializer and follow its definition it could direct you to where the 'System.Text.Json' is imported?
    Would resolve the issue of being unaware of which libraries are used and where from, etc...

  • @ApacheGamingUK
    @ApacheGamingUK 2 ปีที่แล้ว

    With the static abstract interfaces, would this allow you to perform mathematical operations in generic methods, if the constraints are set with these static abstract interfaces? It'd be really handy for vector and matrix functions, where you currently need overloads for vectors of ints, floats, and doubles, with the exact same functionality in each. Having a Vec3, instead of a Vec3f, Vec3d, and Vec3i, would be hugely beneficial. We still have no INumerical interface or equivalent constraint. This could offer a solution, or at the very least, reduce the clutter for any jury rigged workaround.

    • @connorboyle2092
      @connorboyle2092 2 ปีที่แล้ว

      Actually, we do have such a constraint as part of .NET 6 (set LangVersion to preview) that uses the static abstract members. INumber is what you probably want, but there is also more specific interfaces like IMultiplyOperators, IComparisonOperators, IFloatingPoint, etc.

  • @sinkarq578
    @sinkarq578 2 ปีที่แล้ว

    Hey, Nick! What Visual Studio Theme do you use in this video? Thanks in advance 😀

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว +1

      It’s a different IDE called JetBrains Rider

  • @metaltyphoon
    @metaltyphoon 2 ปีที่แล้ว

    You want to see why static abstract is useful, check how Rust implements operations on primitive types.

  • @kevindt100
    @kevindt100 2 ปีที่แล้ว

    I don't know if its a C# 10 Feature or a .Net 6. But the new field keyword can be very nice to use. It makes a lot of code become a lot less.

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว

      The field keyword was pushed to C# 11

  • @kirillzlobin7135
    @kirillzlobin7135 2 หลายเดือนก่อน

    5:32 - lamda improvements. Does it make Func, Actions and I guess something else obsolete?

  • @cdarrigo
    @cdarrigo 2 ปีที่แล้ว

    Nick what program do you use to broadcast your screen in overlay your head in the corner? I have to record some training videos for work, and I'd love to use a similar setup. In the past I've tried to record video on my screen but when it renders it's largely unreadable

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว +1

      I am using OBS Studio and I have a green screen and good lighting to chroma key the background out

  • @antondoit
    @antondoit 2 ปีที่แล้ว

    Great

  • @markusjohansson6245
    @markusjohansson6245 2 ปีที่แล้ว +2

    Thanks for nice video. I have a general reflection on all the c# versions. Its getting really messy. I work at a place where we have like 50 microservices written in c#. There is no time (and would be waste of time) to constanly update to the latest versions. So as a developer you need to keep track of what version you are in. Sometimes the feature is not available so you have to go back to a earlier version of doing this. I have been working with c# since 2005 so Im ok, In know how to do everything in .net 1.1, but I cant imagine how a new developer would cope with this "mess".

  • @oskioskioski
    @oskioskioski 2 ปีที่แล้ว +1

    What made you switch to Visual Studio from Rider?

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว +6

      I haven't. I'm only using it because Rider doesn't support all the C# 10 features yet. The moment it does I will switch back. I am not having fun at all with VS.

    • @sheveksmath702
      @sheveksmath702 2 ปีที่แล้ว +1

      @@nickchapsas fingers crossed, maybe it will be better when VS 2022 comes out in a few weeks?

  • @parapadirapa
    @parapadirapa 2 ปีที่แล้ว

    What's the shortest and quickest way to refactor the 'classic' Namespace to a File Scoped Namespace, desirably using keyboard shortcuts?

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว

      Rider has that in the quick actions menu Alt+Enter

  • @nooftube2541
    @nooftube2541 2 ปีที่แล้ว

    I’ve faced issue when the was need in partial class within the same file because of different usings (they were conflicting).

  • @wangengzheng8931
    @wangengzheng8931 2 ปีที่แล้ว

    nice

  • @babri1402
    @babri1402 2 ปีที่แล้ว +2

    I am a bit confused about why they introduced record structs, it just makes it very confusing.
    Records were supposed to be immutable version of class. Now we have record structs that are actually mutable. Secondly now that we have record structs, why should one use structs instead of record structs or vice versa?

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว

      Actually records could always have mutable elements. Think of them as data classes with some immutability first logic, but that's about it. Both record classes and record structs can have mutable elements, that doesn't change. Using record structs over structs are, again, a matter of usecase and preference. Do you have a struct that just have a few immutable properties and a constructor? Make it a record. Is it more complicated than that? Then maybe use a simple struct.

    • @carlinhos10002
      @carlinhos10002 2 ปีที่แล้ว

      Structs aren't immutable by default anyway.

  • @dire_prism
    @dire_prism 2 ปีที่แล้ว

    I wish C# could add much more support for const expressions.

  • @Anequit
    @Anequit 2 ปีที่แล้ว +1

    Are you enjoying vs2022 or are you going to go back to rider?

    • @nickchapsas
      @nickchapsas  2 ปีที่แล้ว +10

      VS is fine but I can't wait for Rider to have full C# 10 support. Everything just slows me down and there are quite a few things I am missing. It is not a bad IDE but my experience can be summarized as "Death by a thousand cuts". I feel like Rider respects me and my time/productivity as a developer more. When both IDEs have their full releases I will make a video talking about it.

    • @Anequit
      @Anequit 2 ปีที่แล้ว

      @@nickchapsas Looking forward to that video :)

  • @armanx2
    @armanx2 2 ปีที่แล้ว +1

    I still need to learn the features from C# 9.... Things are moving too fast for me 🤕

  • @misha130
    @misha130 2 ปีที่แล้ว

    So can we now have IoC with csproj?

  • @asdasddas100
    @asdasddas100 2 ปีที่แล้ว

    Holy shit they added TypeClasses to C#

  • @arnabmondal5596
    @arnabmondal5596 2 ปีที่แล้ว

    Isn't it something very similar to module concept on VB?? Just asking

  • @fredchuks7822
    @fredchuks7822 2 ปีที่แล้ว

    Please, how do I call methods in csharp 10

  • @AveN7ers
    @AveN7ers 2 ปีที่แล้ว

    Dat JavaScript influence

  • @bigdogsmallman
    @bigdogsmallman 2 ปีที่แล้ว

    Could you make videos on yaml pipelines?

  • @KebunH
    @KebunH 2 ปีที่แล้ว

    11:18 I see you’re a man of culture 😏

  • @urbanelemental3308
    @urbanelemental3308 2 ปีที่แล้ว

    Can you provide a better example of the pattern matching? I don't understand why you wouldn't just put if(rectangle.Height > 100) {}.

  • @ahmedtalaat27
    @ahmedtalaat27 2 ปีที่แล้ว

    it's something weird to see something old in c++ is a new feature LOL

    • @ahmedtalaat27
      @ahmedtalaat27 2 ปีที่แล้ว

      @Oddik Aro Use boost advanced tasks but there is particular situations you cant even use async in c# or tasks in c++ ex: sockets. you need to use it in outside process.

  • @ad9291
    @ad9291 2 ปีที่แล้ว +4

    420, 69, all over the place :D

    • @bennymountain1
      @bennymountain1 2 ปีที่แล้ว

      .NET 6, C# 9

    • @ad9291
      @ad9291 2 ปีที่แล้ว

      @@bennymountain1 Mind, blown

  • @matiaskloster9963
    @matiaskloster9963 2 ปีที่แล้ว

    Do global usings reduce performance?

    • @jerrynothstine2926
      @jerrynothstine2926 2 ปีที่แล้ว

      Usings are only used at compile time. May, possibly, slow down things while compiling but not runtime.

  • @user-cw6ie8sy8w
    @user-cw6ie8sy8w 2 ปีที่แล้ว

    Why you turned off subtitles in this video guide?

  • @reyreyalldayday5708
    @reyreyalldayday5708 2 ปีที่แล้ว

    That function thing looks like es6 javascript

  • @teseract7442
    @teseract7442 2 ปีที่แล้ว

    Hey Nick, can explan newtonsoft framework? please! thanks :)

  • @Ozuqam
    @Ozuqam 2 ปีที่แล้ว

    I think this is more elegant .
    var someFunc=()=> default(string?);

  • @CreamoftheCrop
    @CreamoftheCrop 2 ปีที่แล้ว

    I'm just here to comment on the "AssAndDeclarationInSameDeconstruction"

  • @dalekman8945
    @dalekman8945 2 ปีที่แล้ว

    Does anybody know what IDE this is? It doesn't look like rider👀

  • @Mortizul
    @Mortizul 2 ปีที่แล้ว

    Static abstract classes look like Monoids to me.

  • @Obyvvatel
    @Obyvvatel 2 ปีที่แล้ว

    Oh wow generic way of doing arithmetic, now I'll be able to make generics with a type restriction for things that have a + and - operators.

  • @Kantaros
    @Kantaros 2 ปีที่แล้ว

    I'm rather perplexed by global usings.
    Yeah, sure, you probably want to put System and System.Collections.Generic in every single file in your solution, but it seems kind of pointless for more niche/specialized namespaces.

    • @chrisroyle4813
      @chrisroyle4813 ปีที่แล้ว +1

      We try and contain our company extension methods within the same namespaces per library e.g. Abc.Xpo.ExtensionMethod. Putting these into global usings will be a timesaver for us.

    • @Kantaros
      @Kantaros ปีที่แล้ว +1

      @@chrisroyle4813 that makes a lot of sense. I'm even tempted to steal this 😁

  • @alexvanheerden5702
    @alexvanheerden5702 2 ปีที่แล้ว +1

    My like was the 69th, not that that is a special number or anything.

  • @robl39
    @robl39 2 ปีที่แล้ว +1

    Ref struct, record struct, record class, ValueTask, blah, blah. They are getting a little out of control IMO

  • @Obyvvatel
    @Obyvvatel 2 ปีที่แล้ว

    Yeah, now let's wait like 3 years untill it comes to Unity lol

  • @lachee3055
    @lachee3055 ปีที่แล้ว

    Global using is gross, i cant believe that got approved.

  • @ignisAnimus
    @ignisAnimus 2 ปีที่แล้ว +1

    Who the hell disliked this video? :D

  • @CabbageYe
    @CabbageYe 2 ปีที่แล้ว +1

    String interpolation for const doesn't really make sense to me

    • @the-niker
      @the-niker 2 ปีที่แล้ว +2

      It means you can now use string interpolation in Attributes, because they require a const value. Imagine [MyHandler(Name = $"{nameof(MyClass)}Handler")] . There are other uses, I'm pretty sure I bumped against this limitation a couple of times and had to work around it in uglier way, just can't remember the specifics.

  • @bies_moron4404
    @bies_moron4404 11 หลายเดือนก่อน

    C# become complete garbage :(
    C# 6.0 were perfect btw

  • @doctor9101
    @doctor9101 2 ปีที่แล้ว

    U must b hating java then

  • @mortenbork6249
    @mortenbork6249 2 ปีที่แล้ว

    I dont agree with your love of var usage and inference from actions and functions.
    Having the type defined, eases the readability of the code.
    This seems like an attempt to obfuscate code.
    Code you should read as a sentence, easy to grasp.
    And while it can be subjective, I don't believe it is in this case.
    Func test = () => "Some text";
    and
    var test = () => "Some text"
    while takes a tiny bit less spass, also completely removes understanding.
    if your "result" isn't a declared constant , but a method, then the return is defined inside the method, and you are deliberately hiding the returned object via var, making the code harder to read.
    Not to mention the horror that is:
    var text = string? () => null;
    why would you not write:
    string? text = () => null;
    I hate that they permitted this.