What's New in .NET 9 with Examples

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 150

  • @jaywalks9918
    @jaywalks9918 27 днів тому +25

    00:00:00 - Introduction to .NET 9: Overview of new features and their importance.
    00:00:34 - Feature Switching: Explanation and implementation of Microsoft's built-in feature flags.
    00:03:00 - LINQ Enhancements: New LINQ methods, including AggregateBy and CountBy.
    00:07:00 - Spans and Memory Efficiency: Efficient use of ReadOnlySpan and ReadOnlySet.
    00:16:44 - Hybrid Caching System: Demonstration of combining memory and distributed caching.
    00:22:10 - JSON Schema Exporting: Exporting schemas for external integration and OpenAPI updates.
    00:24:14 - Sequential GUIDs: Introduction of version 7 GUIDs for database and distributed systems.

  • @liski12
    @liski12 29 днів тому +9

    The way Nick writes stuff in his project and when he opens them, just removes them without addressing them, or even smiling, makes me chuckle every time. "JASON!"

  • @honzajscz
    @honzajscz Місяць тому +96

    The variable Dic really got me laughing :-)

    • @nickchapsas
      @nickchapsas  Місяць тому +32

      it's all about that new dic

    • @honzajscz
      @honzajscz Місяць тому +1

      @@nickchapsas I love the video and your work. Wonderful stuff. I am even a PRO on Domtrain to support you! But it is more about how the the Dic variable is pronounced :-)

    • @Carlos-rc1ix
      @Carlos-rc1ix Місяць тому

      Dic, hello 69

    • @ahmedabd-a6
      @ahmedabd-a6 Місяць тому +10

      Followed by hello 69

    • @da3dsoul
      @da3dsoul Місяць тому

      Try not to let your dic get too big. You want to keep it managed

  • @rasimismatulin1400
    @rasimismatulin1400 Місяць тому +58

    LIKE this who wait video about EF Core changes

  • @xaberue
    @xaberue 2 дні тому

    amazing summary in just 25min, thanks!

  • @AlFasGD
    @AlFasGD Місяць тому +6

    params was only legal with an array type, not even list, enumerable or the alike. So we also get that, and full support for spans, making the feature complete. Though I still reckon it useless now that we've got collection expressions, which were made for the sole purpose of making it more convenient to express a collection of elements.

  • @theMagos
    @theMagos Місяць тому +20

    We're doing decimal.Add() over + now?

    • @Bliss467
      @Bliss467 Місяць тому +1

      Yeah, not sure the point. Why would that just be the implementation for the + operator?

  • @codewkarim
    @codewkarim Місяць тому +21

    Genuine question, why did you use the decimal.Add instead of just + the operands?

  • @aweklin
    @aweklin Місяць тому +4

    Hi Nick, thanks for sharing this.
    Wondering if we can someday get a playlist on Span, because I want to learn it in-depth to master how and when to use it.
    Thanks in anticipation.

  • @jjxtra
    @jjxtra Місяць тому +9

    Stone cold face when referencing the holy numbers. Impressive.

  • @justinharris6197
    @justinharris6197 Місяць тому +10

    I wonder why they didn't add SumBy and AverageBy

  • @codewkarim
    @codewkarim Місяць тому +4

    07:17 Nick turns to a salesman for a couple of seconds, his tone, his character even his gesture changes x)

    • @ahmedabd-a6
      @ahmedabd-a6 Місяць тому +2

      Noticed 😅

    • @fredrikjosefsson3373
      @fredrikjosefsson3373 Місяць тому +1

      I didn't know there were people who existed on the internet without adblocks. Thats crazy!

    • @codewkarim
      @codewkarim Місяць тому

      @@fredrikjosefsson3373 Hahaha, I like my favorite UA-camrs to be paid 😂😂

    • @nickchapsas
      @nickchapsas  29 днів тому +1

      Gotta make some bread

  • @anastayach2484
    @anastayach2484 29 днів тому

    Thx for this high quality content nick 👌

  • @OndrejMusicIsMine
    @OndrejMusicIsMine Місяць тому +3

    Personally I liked the backing field keyword addition the most.

  • @IronDoctorChris
    @IronDoctorChris Місяць тому +7

    I dont really follow what benefit that feature flag has over using normal IOptions. Unless you want the AOT trimming that Nick mentions

  • @bjk837
    @bjk837 Місяць тому +2

    Thank GOD for the discount code. I missed my chance the first time and flat out couldn’t afford it lol

  • @MrLucki001
    @MrLucki001 Місяць тому +10

    Do you plan any Dometrain courses about .NET Aspire or/and GenAI with C#? This would be very helpful :)

  •  Місяць тому +5

    Why is AggregateBy using decimals (instead of ints or longs). And why use decimal.Add instead of simply + ? Am I missing something?

    • @lordmetzgermeister
      @lordmetzgermeister Місяць тому +2

      I wonder if it's a meme or an internal joke.
      There's no reason why you'd aggregate integers into a decimal, that's for sure.

  • @10Totti
    @10Totti Місяць тому +2

    Great Video, please video for Blazor!

  • @emfi8744
    @emfi8744 25 днів тому

    In my experience, a feature flag requires quite often a new IoC container.
    Feature disable => register null object
    Feature enabled => register real object
    That means that I have to perform a deployment, when I change the flag.

    • @ShinyBorel
      @ShinyBorel 22 дні тому

      through wrapper classes, all things are possible

    • @emfi8744
      @emfi8744 22 дні тому

      @ShinyBorel Yes, I could introduce a factory, or a Func, but I would carefully consider the pros and cons

  • @paulberndsen7554
    @paulberndsen7554 Місяць тому +3

    We implement feature flags via database settings. By doing it this way, we are able to update the flags value runtime and enable/disable features.
    With this implementation, we always need to deploy the application with the changed flags values. I haven't found a way around that. Do you have any suggestions?

    • @JanVerny
      @JanVerny Місяць тому +2

      I suppose that is the intended use case. So you can have your own internal features that never get shipped into production.

  • @zoltanzorgo
    @zoltanzorgo Місяць тому +1

    I really tried to adopt HybridCache ahead. Although the flags is a great feature to control how items are handled, it is too simplistic. I really missed the plain Get(Async), and the ability to gracefully cancel adding something to the cache. The backplane is also something that is a must for L1+L2 caching IMHO... So for now HybridCahce is the way to go for me...

    • @jodydonetti
      @jodydonetti Місяць тому +1

      Having mentioned the backplane I assume you are using FusionCache now, glad you’re liking it (creator here).

  • @tbgelectr0
    @tbgelectr0 13 днів тому +1

    Do I understand correctly that the difference between a config.json and this is that the new feature is like a precompiler statement so it get removed entirely from the compiled code?

  • @Larsan
    @Larsan Місяць тому +8

    "some number" 🤭

  • @I-PixALbI4-I
    @I-PixALbI4-I Місяць тому +2

    MORE SPANS!
    More about ASP .Net Core and EF

  • @melnor82
    @melnor82 Місяць тому

    Glad you mentioned the "meh" part

  • @shinkathe
    @shinkathe Місяць тому

    Dude had a lil' Heavy Rain reference in there :D

  • @Kimo.Codess
    @Kimo.Codess Місяць тому +1

    Can the V7 Guids replace the old Guid in an existing application or you have to start with it in order to see it's benefits?

    • @fredrikjosefsson3373
      @fredrikjosefsson3373 Місяць тому

      If the newer stuff in your database is more relevant, and you start using V7, then eventually you will get the benefits I believe. Maybe not as good as if all the guids were V7 but I think it will in the long run. I'm just guessing so take this comment with a grain of salt

  • @djriversxiv
    @djriversxiv Місяць тому

    Dic is back! :D

  • @emfi8744
    @emfi8744 25 днів тому +1

    I don't understand why AggregateBy was introduced: it's just a one line extension method.
    And then why only CountBy?

  • @alanschmitt9865
    @alanschmitt9865 Місяць тому

    They’re probably slow rolling `HybridCache` because stampede protection feels like such big deal. Gotta be sure it works.

    • @jodydonetti
      @jodydonetti Місяць тому

      If you are interested in HybridCache, you may take a look at FusionCache that Nick mentioned, too (shameless plug 😅).
      It has a very similar design (L1 MemoryCache + L2 IDistributedCache) but it has been around for years, battle-tested in production, is even used by Microsoft itself (eg: see Data API Builder) and has a ton of extra features, particularly around resiliency.
      Not posting the link to avoid bans, but it’s easy to find.
      Hope this helps.

  • @tyk37
    @tyk37 Місяць тому +4

    The weather is the same within like 5 minutes unless you live in London or something 🤣

  • @magicsmoke0
    @magicsmoke0 Місяць тому +1

    Not really seeing the benefit of the new feature flag system. If it's all in memory, then how can I do A/B testing on it. Like, there needs to be a way to toggle the flag externally while the process is running, like feature flagging systems do today.

  • @ryan-heath
    @ryan-heath Місяць тому +3

    Wonder why the whole swagger ui was removed.
    Of course we can go in and add it our self but I need some explanation.

    • @janpul1590
      @janpul1590 Місяць тому

      Because its not maintained anymore I think

    • @paulkoopmans4620
      @paulkoopmans4620 Місяць тому

      Delivering just the standard OpenApi document allows users to use whatever they want. So if one is more of fan of Postman, Insomnia, Rider, etc. you can just import that spec. The other thing that one should worry about is external dependencies, both "what" and "how many". Every external dependency you have could become a risk. For example it might die, get stale, become monetized, even becoming a security risk.

    • @KimichisxD
      @KimichisxD Місяць тому

      I am purely guessing, but I think the original solution might not be AOT friendly as they might use Reflection for discovering endpoints, etc.

  • @Danny1986il
    @Danny1986il Місяць тому

    At this point we really need a reboot of the whole thing where allocations are minimized by default

  • @pfili9306
    @pfili9306 Місяць тому

    Hey Nick, if I switch from monthly Dometrain Pro to yearly will I be able to use Black Friday Promo code?

  • @GendoIkari_82
    @GendoIkari_82 Місяць тому

    How is the new Features thing different in practice from reading a bool from IConfiguration?

    • @SconedCyclist
      @SconedCyclist Місяць тому

      It completely removes the code. Reduces the evaluation by a single if check. Basically, the same as using a ConditionalAttribute w/ a compilation symbol.

  • @RumTerry
    @RumTerry 27 днів тому

    System.Diagnostics.Conditional > FeatureSwitch

  • @F1nalspace
    @F1nalspace Місяць тому

    Interesting. Can i use IMemoryCache without the HTTP stuff? In normal .NET, like in a console / WPF app ?

  • @cezarpimentel
    @cezarpimentel Місяць тому

    Great video! By the way, the hybrid caching was already covered on another video. Thanks for all the amazing content! 🫶

  • @robca6268rmfe
    @robca6268rmfe 28 днів тому

    Nick, when a video about Agile/Scrum/SAFe/etc. and how they have become a jail for really productive developers?

  • @GioacchinoPiazzolla
    @GioacchinoPiazzolla 24 дні тому

    Wait a second, how Feature Switching interact with all the previous ways to obtain feature flag? Like App Settings files? Or Feature Management? Azure App Configuration or other external feature flag management systems?

  • @adrian_franczak
    @adrian_franczak Місяць тому

    If there a way to configure this feature in runtime (let’s say we are using configuration from aws appconfig)

  • @elishnevsky
    @elishnevsky Місяць тому +1

    18:06 "... and kill another library" 😭

  • @RydianInGreen
    @RydianInGreen Місяць тому +2

    Press X to Jason.

  • @hello_andrewgunn
    @hello_andrewgunn Місяць тому +3

    Nice choice of variable name for a dictionary 😂

  • @Bliss467
    @Bliss467 Місяць тому

    I’m annoyed Microsoft is still using out parameters in new features. Is it so hard to return an option or result type or just use null?

  • @oussama7132
    @oussama7132 Місяць тому

    why was helloWorld greyed out after you changed it to readonlyspan?

    • @billy65bob
      @billy65bob Місяць тому

      because it wasn't used, and was offering a refactor to get rid of it.

    • @oussama7132
      @oussama7132 Місяць тому

      @@billy65bob but it wasn't before that either

  • @jimread2354
    @jimread2354 Місяць тому

    So... "Feature switching" was implemented in COBOL in the 60s and it was WAY simpler to use. Color me unimpressed by this feature. It's also redundant as you've been able to use arguments to do the same thing since probably .NET 1. And if you wanted to drop code out of the compiled output, you could use compiler switches and #ifdef.

    • @Kitulous
      @Kitulous Місяць тому

      I also thought it was a useless feature since you could use appsettings.json or #defines.

    • @sealsharp
      @sealsharp Місяць тому

      FeatureSwitching is a strange mix of compile time and runtime. The project file settings getting built in and the stripping of the code for AOT has compile time behavior while the actual lookup from the static AppContext is runtime.
      They use that way to setup parameters for GarbageCollection etc. since NetCore and i kinda like choosing between a json and project file better than the old appConfig.
      In a way it is probably more convenient than building your own static config class or #ifdef but it doesn't seem very elegant to me.

  • @aleksandarangelov3536
    @aleksandarangelov3536 Місяць тому

    Totally random numbers 69 and 420 :)

  • @dimitriosmakridis2898
    @dimitriosmakridis2898 Місяць тому

    Does domtrain have some certifications I can add to linked in? XD

  • @ВладиславДараган-ш3ф

    Why should someone use Feature Switch when there is IConfiguration and IOptions? It looks completely redundant right now.

  • @mbalaganskiy
    @mbalaganskiy 24 дні тому

    An interesting hybrid cache feature - tags - is not implemented

  • @paleta_ar
    @paleta_ar Місяць тому

    dict instead of dic for the next one :D

  • @lucasteles42
    @lucasteles42 28 днів тому

    And about the F# news? 👀

  • @TheFeaz
    @TheFeaz Місяць тому +1

    Am I smoking something? LOL... In your first example, my first thought (before you changed the code to use the || operator), I thought you ought to default that to false, b/c if the TryGetFeature fails, you wouldn't want to default to TRUE... but anyway... then you converted the statement to use an OR for the result... but isn't the result of one of these TrySomething(...) calls the result of the "try"? Meaning that if it fails, it returns FALSE, and if it succeeds, it returns TRUE, and the actual result (assuming that the try succeeds), is whatever is output (in this case TRUE if the feature is enabled and FALSE if not)... so in that case, since the TRY always succeeds (e.g. TRUE), and you did a || isEnabled, the result of TRUE || anything is always going to be TRUE.
    Sorry to be so wordy... Maybe I missed something, because clearly your demo worked, but I'm just wondering what I failed to catch there.

    • @nickchapsas
      @nickchapsas  Місяць тому +1

      basically if the feature switch can't be found the feature is on by default, otherwise use the configuraiton that was found in the settings. You can change that behavior however you like

  • @theprantadutta
    @theprantadutta Місяць тому +7

    Bro had to guess two random numbers, and he guessed "69" and "420", totally random numbers, I don't even know why I am pointing that out.

    • @miloradowicz
      @miloradowicz Місяць тому

      What's so special about 420?

    • @ghaf222
      @ghaf222 Місяць тому +3

      It’s a drug reference. Personally I think it’s pretty lame.

  • @inzyster
    @inzyster Місяць тому

    Press X to JSON

  • @erynmacdonald
    @erynmacdonald Місяць тому

    "And kill another library" yep Ms doing Ms things 😅

  • @mbalaganskiy
    @mbalaganskiy 24 дні тому

    New guids are not compatible with sql server sorting, beware :) if only two products were made by the same company...

  • @xxapoloxx
    @xxapoloxx Місяць тому +1

    ORMs are only for simple ABMs, procesing through and ORM is asking for trouble. That is what SQL is there for.

  • @IllidanS4
    @IllidanS4 Місяць тому +1

    I am still disappointed that params IEnumerable (or a collection expression converted to IEnumerable) constructs a hidden ReadOnlyArray behind the scenes from the array. Like why? An array is already an IEnumerable, and since it gets created too at that point, there is no code that cares about the elements after the call. Nothing except the target may observe any modifications, and not having access to the underlying array misses out on optimizations performed by the target.
    "params" or collection expressions should construct the strongest implementation of the interface (that being an array in the case of IEnumerable), not the weakest implementation.
    Just don't use params or collection expressions with interfaces.

  • @kalist8938
    @kalist8938 Місяць тому

    Nothing really new for blazor. They said “Aspire” almost hundred times in this .net conf.
    Very disappointing.

  • @user-tk2jy8xr8b
    @user-tk2jy8xr8b Місяць тому +4

    No discriminated unions again :(

    • @Sayuri998
      @Sayuri998 Місяць тому +1

      Unions is still years off at this stage. It has only been proposed. They're still at the preliminary stage at having proposed an API. They still have to incorporate feedback, implement and validate prototypes, etc. But we still have nice packages in the meantime that can help cross the gap, e.g. OneOf.

  • @Tsunami14
    @Tsunami14 Місяць тому

    "dic"

  • @Jason_Kang
    @Jason_Kang 29 днів тому

    Saw a few comments about why Nick was using 'decimal.Add' over the '+' operator so thought I'd step in to help clear up any confusion.
    You would think that these two ways would do exactly the same thing. Well if you read the official C# documentation you would find out that you are completely correct and the reason Nick uses 'decimal.Add' is cos he's a crazy muthafucka.

  • @ChannelZeroBG
    @ChannelZeroBG Місяць тому

    what a waste

  • @Steven-ch2wm
    @Steven-ch2wm Місяць тому

    So the AggregateBy and CountBy allow us to do what we could already do easily and more readable as follows?
    from lesson in completedLessons
    group lesson by lesson.CourseId into g
    let totalWatchTime = g.Sum(lesson => lesson.LessonDurationSeconds)
    select $"Course id: {g.Key}: {totalWatchTime} seconds";
    from lesson in completedLessons
    group lesson by lesson.LessonId into g
    select $"Lesson id: {g.Key}, {g.Count()} times";
    Am I missing something?

  • @tomtoups
    @tomtoups Місяць тому +4

    Feel like he's a little too old to use sexual innuendos in his videos. What is this .NET for middle schoolers? I don't know if anybody actually finds this funny but it really makes him seem less credible and immature.

    • @Sayuri998
      @Sayuri998 Місяць тому

      'Dic' is not the same as 'dick', a synonym for 'penis'.

  • @GigAHerZ64
    @GigAHerZ64 Місяць тому

    24:30 "sequential", really? They are not sequential, did you look at it? That's the issue. You need ULID, not this mess called UUIDv7.

    • @nickchapsas
      @nickchapsas  Місяць тому +3

      Sortable would have been the right word

    • @GigAHerZ64
      @GigAHerZ64 Місяць тому

      @nickchapsas it still doesn't sort right. You can sort a classic GUID, too, if you wish. Its going to be random order. You can see it from your own video that those 3 values would sort into wrong order.

    • @zalatos
      @zalatos Місяць тому

      what do u see as the purpose of a GUID?

    • @izobrr
      @izobrr Місяць тому +1

      ​@@nickchapsas monotonous

    • @metlov
      @metlov Місяць тому +1

      ​@@GigAHerZ64you look at them as if they were strings and try to sort them lexicographically left to right. There's a specific bytes placement logic, some of them are even sorted in reverse. Try to sort 20 GUIDs, you'll see.

  • @lifelover69
    @lifelover69 Місяць тому

    Thanks for the overview Nick. I still write C# at work, but personally I never create a new project in C#, when there is Go. Overall .NET 9 is a disappointment to me, there are some nice features, but it seems they are trying to please everyone, and lack a strong vision for the future of C#/dotnet. It's a perfectly capable and productive language, just not for me anymore. Thanks

  • @mitkonanov
    @mitkonanov Місяць тому

    first view and comment

  • @Kloppers_G
    @Kloppers_G Місяць тому

    First!

  • @xnetc9
    @xnetc9 Місяць тому

    42069. nice....

  • @BasvanderVeeken
    @BasvanderVeeken Місяць тому

    youtube.com/@ididathing 😂