Delegates & Events in C# Explained for Beginners (a little of Event-Driven Development)🔔

Поделиться
HTML-код
  • Опубликовано: 21 сен 2024
  • 🚀 Join the .NET Web Academy: dotnetwebacade...
    ➡️ Use code START2024 for 10% off!
    🚀 Get the .NET 8 Web Dev Jump-Start Course for FREE: dotnet8.patric...
    💖 Support me on Patreon for exclusive source code access: / _patrickgod
    🐦 Let's get social on Twitter/X: / _patrickgod
    🔗 Let's connect on LinkedIn: / patrickgod

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

  • @PatrickGod
    @PatrickGod  8 месяцев назад +23

    Hey friends! 👋 Patrick here. I wanted to add a quick note to this tutorial. I missed mentioning something important: the built-in generic delegates Func and Action. These are really handy for common scenarios - Func is used for methods that return a value, and Action for those that don't return anything. They often simplify the code compared to custom delegates.
    I'll make sure to cover these in more detail in a future video. Stay tuned, and happy coding! 😊👨‍💻
    Patrick

    • @dhruvsharma9230
      @dhruvsharma9230 6 месяцев назад

      what sit u explain do u know how explain beginner pig

  • @dasfahrer8187
    @dasfahrer8187 8 месяцев назад +7

    I think a much deeper dive is needed for these concepts (why they exist, what problems do they solve, why use them over something simpler and more direct, etc...) as you're getting into more advanced programming and complexity by implementing them. You typically don't use them willy-nilly.

    • @agusstiinbt
      @agusstiinbt 8 месяцев назад +1

      Great answer. I also think that delegates and events are only useful in certain situations. In this case in was only useful to learn about them. But not a great example of when you consider using them

    • @weamhaleemi4984
      @weamhaleemi4984 8 месяцев назад

      Try learning rabbitMq without them.. it wont work

  • @charliehager5458
    @charliehager5458 8 месяцев назад +13

    You make a very good point that delegates and events are very easy to create and use. Probably under utilized these days. Possibilities for use are endless. Thanks!

    • @PatrickGod
      @PatrickGod  8 месяцев назад

      Glad I could help! Thanks for your feedback!

  • @Kla-pn4kt
    @Kla-pn4kt 8 месяцев назад +13

    as a blazor beginner, your explanation is really helpful. Thanks.

    • @PatrickGod
      @PatrickGod  8 месяцев назад +1

      Thanks a lot for your feedback! Glad I could help. 😊

  • @3k1p5
    @3k1p5 8 месяцев назад +2

    I really like your way to describe the principles in clear understandable ways. Keep going it's great, thanks.

  • @philippemaze4562
    @philippemaze4562 2 месяца назад

    One of the clearer tuto I follow about event & delegates...Thank you so much Patrick !

  • @vukasin97
    @vukasin97 8 месяцев назад +6

    Very nice explanation 👍 Also that bright light in your background gives a nice fresh look to the video

    • @PatrickGod
      @PatrickGod  8 месяцев назад

      Thank you! Funny you're mentioning the bright light. It was actually just the sun shining through the window and I thought it was too bright. 😅

  • @fryser007
    @fryser007 7 месяцев назад

    I'm taking a class on Coursera and the teacher sucks, I have to look up on the youtube some key concepts they explain badly and you sir knock it out of the park. Thank you :)

  • @SatyaketuSanjay
    @SatyaketuSanjay Месяц назад

    I was searching for this easy explaination! Thank you Patrick!!

  • @Ayymoss
    @Ayymoss 8 месяцев назад +1

    Question; why should we use explicit delegate over Action for example? I think this has the same functionality, but in one line rather than 2?

    • @PatrickGod
      @PatrickGod  8 месяцев назад +3

      Good point! In the given example, using Action instead of a custom delegate like AchievementUnlockedHandler would indeed simplify the code. The choice here was mainly to demonstrate how custom delegates work and how they can be used to create events.
      In practical applications, opting for Action is a great idea for its simplicity and brevity, especially for straightforward cases like this. Custom delegates become more useful when you need more descriptive names or complex method signatures. Thanks for pointing this out!

    • @Ayymoss
      @Ayymoss 8 месяцев назад +1

      @@PatrickGod Ah, thank you for clarifying. :)

  • @douglasemsantos
    @douglasemsantos Месяц назад

    Great explanation! Thank you!

  • @38911bytefree
    @38911bytefree 8 месяцев назад +2

    Thanks man, Im a bit rusted on these concepts .. LOL

    • @PatrickGod
      @PatrickGod  8 месяцев назад

      Anytime! Glad I could help! 😊

  • @anasabubakar4125
    @anasabubakar4125 8 месяцев назад +4

    Aren't Func and Action a built-in delegates ? I think they are easier to understand than creating custom delegates

    • @PatrickGod
      @PatrickGod  8 месяцев назад +2

      Yes, you're absolutely right! Func and Action are indeed built-in generic delegates provided by .NET. They are often more convenient and easier to understand, especially for common scenarios. Func is used for methods that return a value, while Action is for those that don't. Custom delegates are more about understanding the underlying concept and are useful in certain specialized cases. Great observation! 👍

  • @MEGAFOXTERRIER
    @MEGAFOXTERRIER 8 месяцев назад +1

    Loving these videos! Could you also please make a Blazor Auto Render Mode CRUD Full Course video?

  • @tidianediallo6199
    @tidianediallo6199 8 месяцев назад

    That's great master Patrick, as a blazor beginer I'm excited? Thank you of lot.
    The explanations are clear and I hate the next video.
    also a tutorial on the connection of webApi, signalR and Chatgpt🙂

  • @maacpiash
    @maacpiash 8 месяцев назад

    Excellent video. Concise, clear, to the point.

  • @shahnawazk
    @shahnawazk 8 месяцев назад +1

    Very helpful and informative. Thanks and keep it up!

    • @PatrickGod
      @PatrickGod  8 месяцев назад

      Thank you so much!

  • @KatSanok
    @KatSanok 8 месяцев назад

    Patrick you do a great job ! Thanks for another nice explaining video.

  • @moejahi3d3
    @moejahi3d3 8 месяцев назад

    Love this! looking forward to the big video. We;re not using .net8 yet but your channel is great to keep up2date or at least in the "know" hehe.
    Any chance you could make a .net8/identitity server/ Multi tenant video with a central login system shared client but seperate db for each tenant? Been looking into this this week for some idea's hehe.

  • @chaikuanhong
    @chaikuanhong 3 месяца назад +1

    good work!

  • @gouravkanthed3246
    @gouravkanthed3246 7 месяцев назад

    Good Explanation..It would be great if u have included delegates with return type also

  • @PavanTripathi-rj7bd
    @PavanTripathi-rj7bd 7 месяцев назад

    Thanks for the wonderful explanation!

  • @shobhamahadev118
    @shobhamahadev118 6 месяцев назад

    i understood properly today abt these concepts.

  • @brianking8883
    @brianking8883 8 месяцев назад

    I like this format.

  • @imanqoly
    @imanqoly 4 месяца назад +1

    First event explanation that didn't confuse me

  • @FredBCavalheiro
    @FredBCavalheiro 8 месяцев назад

    Excellent explanation. Thanks

  • @yuhsiangchen7784
    @yuhsiangchen7784 4 месяца назад

    Thanks

  • @srujansanga2689
    @srujansanga2689 5 месяцев назад +1

    I subscribe ! Hoohoooooo

  • @cjt9150
    @cjt9150 8 месяцев назад

    Good work. Can you please create a video for custom authentication with cookie/local storage/session storage & without identity

  • @lean2009
    @lean2009 5 месяцев назад

    great lesson!

  • @CyprianLibera
    @CyprianLibera 8 месяцев назад

    Very good!

  • @kandycan
    @kandycan 8 месяцев назад

    Very good tutorial

  • @NIKOLAOSGYPAS
    @NIKOLAOSGYPAS 8 месяцев назад

    Thanks for the great video Patrick. Is there a way to know if I have subscribed to an event,

  • @Brian-nz6ns
    @Brian-nz6ns 3 месяца назад

    Not well explained...

  • @FilthySnob
    @FilthySnob 3 месяца назад

    Messy bullshit

  • @essentia9
    @essentia9 28 дней назад

    dude I don't know yet what a delegate is and you are throwing into my face async/await. Kind of stupid

  • @niggacockball7995
    @niggacockball7995 5 месяцев назад +1

    first video i have seen about events that I fully understood
    thx
    Also why make your own delegate instead of simply using EventHandler ?