Pattern Matching in C#

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

Комментарии • 46

  • @PushInMatt
    @PushInMatt 4 года назад +8

    You explained all of these new patterns so well; I went from no knowledge of them to feeling like I could put them into my code in under 20 mins. Love the format of the videos :)

    • @FilipEkberg
      @FilipEkberg  4 года назад +3

      Thank you so much for the kind words! That makes me extremely happy to hear :)

  • @renehilgers
    @renehilgers Год назад

    This is the best video I've seen about pattern matching! And I think it is the most complete video about it! Very good explanations!

  • @NOCLAF-gw7nn
    @NOCLAF-gw7nn 3 года назад

    Thank you, it is the best tutorial i found for Pattern Matching with C#.

  • @Luca-rw8jx
    @Luca-rw8jx 4 года назад +2

    this work is underrated. thanks for doing this and looking forward to more csharp related content

    • @FilipEkberg
      @FilipEkberg  4 года назад

      Thanks so much for the nice comment!

  • @danielecerro3797
    @danielecerro3797 4 года назад +4

    I really like the format of these videos! Great explanation :)

    • @FilipEkberg
      @FilipEkberg  4 года назад

      That makes me very happy to hear. Thank you very much!

  • @aquadury7354
    @aquadury7354 3 года назад

    Hey man! Thank you for your lectures, they are awesome, clear and concise. Came to your channel from your Pluralsight "Command Pattern" xD

    • @FilipEkberg
      @FilipEkberg  3 года назад

      Thank you so much for those kind words! I am happy you like it :)

  • @DarshanaHashendra
    @DarshanaHashendra 2 года назад

    Great explanation , great content. Love to listen to your teachings.

  • @aceplusplusplus7652
    @aceplusplusplus7652 4 года назад +7

    Thank you for this- great insight into Pattern matching, a foundation for my AI!

  • @Sonny0276
    @Sonny0276 3 года назад

    Great Video. Thank you for posting.

  • @zankomag8322
    @zankomag8322 3 года назад

    I really like the way you present information. It's so simple to get it!

  • @SolidJuho
    @SolidJuho 4 года назад

    All of these videos of new features of C# 9.0 are extremely well executed.
    They are short, informative and simple with great examples.
    It would be great to also have these from C# 8.0 which is also "relatively" new.

  • @Expertali66
    @Expertali66 3 года назад

    I just found this channel, and I am very glad that I did! Your description is very clear and the examples you use make it even easier to understand. Keep up the good work!

  • @marklord7614
    @marklord7614 4 года назад +2

    Great video. I'm happy about the patterns and the functional direction of C#. I would love to see discriminated unions come to C# 10...oh and keep the patterns coming too :-)

    • @FilipEkberg
      @FilipEkberg  4 года назад

      Thank you very much!
      You and me both. It's really exciting times for C#. What more patterns would you like to see?

  • @vhbil
    @vhbil 4 года назад

    I get excited about new language features too!

  • @chammu6936
    @chammu6936 3 года назад

    Clear explanation. I have one small question. Can we define the .NET5 like this? .NET5 is the combination of .NET core and .NET Framework

  • @MiniplanePilot
    @MiniplanePilot 4 года назад +1

    Thanks for the video, a really useful overview of the types of pattern matching now available in C# 9.0. I really dislike the way the Positional pattern matching has been implemented because it requires me to go and examine the deconstructor for the object type, I'm not sure how this makes the code more readable.

  • @piotrw3366
    @piotrw3366 2 года назад

    Thank you for making this video! Can I ask you a question?
    In this code *if(n is 1 or 2 || true)* I was fully expecting to be able to use *or* instead of || but it throws an error. Does that mean that to add a 2nd condition we still need to use the logical operators || && ?
    Thanks!

  • @PhinioxGlade
    @PhinioxGlade 4 года назад +1

    The pattern syntax in this example if anything is less readable. It appears way more messy and for people unfamiliar with patterns would just be confusing.

  • @SalimNemoMakouche
    @SalimNemoMakouche 2 года назад

    Good explanation :) still it's not possible to write something like with rust or F# :
    match x {
    1 => println!("one"),
    2 => println!("two"),
    3 => println!("three"),
    _ => println!("anything"),
    }

  • @daonlyowner6631
    @daonlyowner6631 4 года назад +2

    Pattern matching in C# is now better supported than in F#.

  • @RoyZASTEROiD
    @RoyZASTEROiD 4 года назад

    Big thanks for easy explanation. What this code name? i know this is not method decloration, but what is the name of this code? anonym variable? or what?
    var (Name2, Rank2) = GetOfficer(); // what is this part name? : var (Name2, Rank2)
    and this. I understand this is method, but without name..? can u explain what is this?:
    (int Something, string Another) Whatever((int Neat, bool Cool) data)
    {
    return (data.Neat, data.Cool.ToString());
    }

    • @FilipEkberg
      @FilipEkberg  4 года назад

      Thanks!
      The first one, that is known as a tuple.
      In your second example, you return a tuple with two fields (values): one integer named Something and one string named Another. The method accepts a named tuple which you call data, this tuple has two fields (values). The method then returns a new tuple which is constructed using the values from what you passed to the method.
      I hope this helps!

    • @RoyZASTEROiD
      @RoyZASTEROiD 4 года назад

      @@FilipEkberg big thanks, and sorry for my bad english

  • @alexm6762
    @alexm6762 4 года назад +3

    don't like to add new keywords if you can wo them. instead of init you can write readonly set, instead of record you can write imho const class

    • @FilipCordas
      @FilipCordas 4 года назад

      I don't think they are keywords in sense like foreach or while are. They are more positional so you can still use the name as variable names.

  • @PbPomper
    @PbPomper 2 года назад

    The only problem I have with this is that you can not test against variables, which you have to do 95% of the time. Using hard coded values is usually a big no-no in practice.

  • @michaelnurse9089
    @michaelnurse9089 4 года назад +9

    My pattern matching has detected you changed your profession. At the beginning you are a public speaker but at the end you are an author. Very suspicious.

    • @FilipEkberg
      @FilipEkberg  4 года назад +1

      I guess a lot can happen in 16 minutes and 40 seconds :)

  • @djchrisi
    @djchrisi 4 года назад +1

    I sometimes feel sorry for the language team. They worked really hard on such great features and we consumers out there on the internet are only debating about stuff like: var x = new T() vs T x = new()....

  • @wiilillad
    @wiilillad 4 года назад +1

    "Improvements"

  • @yasser2768
    @yasser2768 4 года назад

    I think all of this is not really that important actually it's complicating the code and making it unreadable

  • @BristlyBright
    @BristlyBright 4 года назад

    Varför uttalar du som svensk ditt namn på det sättet? Ekberg. Eckbörg? Ett namn är ett namn och uttalas bara på ett sätt.
    Nu skall jag kolla resten av videon, som jag faktiskt tror är av bra kvalitet, ämnet är av stort intresse.

    • @FilipEkberg
      @FilipEkberg  4 года назад

      Alltid gjort och kommer alltid göra.
      Jag anser att ett namn kan uttalas hur som helst, spelar ingen roll.

    • @BristlyBright
      @BristlyBright 4 года назад

      @@FilipEkberg Tack för svar. Jag tycker det känns konstigt bara. Men respekt för bra kontent skall du ha i alla fall!! 👍

    • @FilipEkberg
      @FilipEkberg  4 года назад

      @@BristlyBright Tack så mycket! Kul att du gillar de :)