This is for me: Example: 1:50 What is a delegate?: 7:52 Func delegate: 18:19 Question: 30:55 Action delegate: 34:00 In line delegates (on the fly): 38:04 WinForm UI: 49:22 WinForm UI with In line delegates: 58:37 Ignoring Action delegate: 1:00:52 When using delegates?: 1:02:15
I recently switched companies and therefore my Java hat to a C# hat. The quality and information these videos provide is insane. Keep up the good work!
Okay, you are officially the first and only good tutorial I have ever seen on delegates. My issue has always been "Why?". Because I understand what delegates do but never understood why I would go through the trouble of setting them up. This shed light on everything! You're the only one to show how delegates can essentially carry the value of a method and make it transferable to different UI's without having to change very much. Thank you so much for putting the time into these videos! I hope I can be a better developer by using this to my advantage because not even people I work with could give me this explanation.
Agreed, that's the problem with 99% of tutorials about this. They always approach it from the purely technical side of things, basically just "it can do this and this and this", which just makes it confusing and annoying. Only when seeing it implemented and applied to an actual problem a developer may face does it actually "click" and become relevant.
@@roydonk2878 very true, though, that's the problem with most tutorials about any abstract subject. Oddly enough I originally went to college to be a researcher in physics and that sort of issue happens constantly when learning math. "This is what this equations does. Memorize it. Look, *writes out equation and solves it in minutes* its so easy." I really appreciate videos like this and the people who make them because it has become apparent that teaching (like actual teaching) is a skill not everyone can learn. There are lots of "teachers" in the world and yet so few who are actually able to teach. I'm thankful Tim is someone who can actually teach a subject instead of just reading the definition out load.
I cannot thank you enough for the extremely resourceful content you put on RUclips for free. You are a exceptional Teacher and great developer. I almost always recommend your content to my co-workers and try to follow your best practices in my daily work.
Tim, you have completely changed the way I look at Delegates. The tutorial was easy to understand and I can't thank you enough for the kind of example that you picked up. I have went over numerous videos on this topic and I'm relatively new to C# but your presentation skills were so to the point that I was able to bridge the gap pretty easily. Please continue making great tutorials like these! I kept on running from delegates before watching this video
Its the hardest thing about learning new or advanced areas in coding, is that the simplicity of the example environment, obscures the usefulness of the new tool.
That is where practice helps. Trying out what you are learning can reveal what you missed or what was not taught. Then you know the right questions to ask to go deeper.
Hi Tim, just let you know that your lessons are becoming an important part of my life, I spend 2 or 3 hrs on listening to them and I love them. Thank you!
Very good explanation, I've programmed in C++ for a long time and when you showed the first example it clicked right away. Didn't even notice before that delegates are the same as function pointers for an example in C++
- The best explanation of Delegate. - The best part of this video is that the focus is on details and that is where the devil lies. - Keep up the good work Tim Corey. :)
Hi Tim, Your videos are astonishing. I am (re)developing my skills, as I decided to unstick a label which was attached to my person, and which is kinda barrier in my carrier. But first I must tell you that I am watching your tutorials with pleasure not only because they all full of tips and valuable information but you dose them at a well selected tempo. It is nor too slow neither too fast. It requires good attention but repeating more difficult or condensed fragments doesn't annoy you and there is a very good reason why. It is your calm, energetic, bright and clear voice, the voice of a person who is sure of what he is speaking and how work the things he is speaking about. Programming is my hobby, and I have developed many programs, aside of my everyday job, mainly in Builder C++ but I started with v3.0 and later didn't keep up with progressing technology. When I saw changes implemented in modern C++ standards 14, 17 ... I was a bit "shocked" discovering Pascal within C++ 😂 I was a bit angry and my son told my that my brain processor runs an obsolete operation system which wasn't patched for a very long time. I am plugged into the industrial automation and robotics world (STL, LAD, FBD, SFC, SCL ...) but fortunately I left some IT related ports open so I am able to upgrade my skills. From time to time I used some devices which work on the edge between IT and OT and faced some problem with samples in C#. As long as you do not need to bother much about programming from scratch, and it is enough to adjust and slightly modify provided examples you don't bother much. Currently I develop a bit more sophisticated software which uses Siemens Openness API and I found out that my knowledge must be quickly updated, especially its C# related area. I was searching for some good resources, bought a book 700 pages book, and then found your channel - IMHO the best one. Thank you very much. JK
Hi Tim. It's been five years since I started working as a developer, yet I still find your videos instructive. There are things I thought I understood, but actually didn't and some aspects that were always foggy for me and that now are coming to light. Thanks for your work, your ability to explain sth you've understood is outstanding. I know a lot of developers that really know what they're doing, but when it comes to explain it to someone else, they fail miserably. Thanks again Tim.
Very good explanation. The conclusion for me (in this concrete case): 1. GenerateTotal can send "messages" to Main while it process its work. 2. I can write the code for some operation GenerateTotal does. So GenerateTotal is just a plan, what have to do, but the concrete code is mine.
0:00 - Intro 1:28 - Demo application walk through 7:52 - Explaining and creating a Delegate 18:19 - Func and Action: problems you can solve with delegates 21:37 - Func Delegate: creating and explaining 30:56 - Why to have delegate, if all the work is done elsewhere 34:00 - Action Delegate: creating and explaining 38:07 - Creating anonymous methods: anonymous Delegate 43:08 - Creating anonymous methods: anonymous Func 45:15 - Creating anonymous methods: anonymous Action 49:30 - Using Delegates in other projects: WinForms 58:37 - Using Anonymous Delegates in other projects: WinForms 1:02:15 - Summary
Thanks, Tim! Seriously an absolute game changer these here Delegates. I feared I'd have to do some weird two-way event thing to pass a request from the logic layer to the UI layer, and then the eventual user reply back to the logic layer. But this unlocks so many new possibilities for my code.
The best explanation so far. In my real life experience those concepts is very hard to implement because the deadline is very tight and the team has no time to think in better design patterns.
They are hard, which is why practicing them to get skilled at them is a big deal. The easier they are to do, the more likely you will be to use them in a real project.
Great thanks Tim for such a wonderful masterpiece. I immediately applied it to resolve my issue: when a lower level code needs to refer to a higher level's method, I used delegate to make it loose-coupled. feel amazed. thanks Tim, you're just the best. :)
I just realized that there was an editing mistake. The video has near-duplicate sections at 49:58 and at 50:23. Threw me off there for a second. The first duplicate already includes the method "PrintOutDiscountAlert". The second duplicate the "PrintOutDuplicateAlert" is added.
Very helpful, have read about delegates a few times through the years but never fully understood them until now. As a long time anti C#-er, I am finally learning to enjoy it.
The value of delegates (and the realization of how much we already use them) really came to the forefront for me when I developed a WinForms app that had a modal progress bar. The progress bar has a BackgroundWorker, however the methods for DoWork and ProgressChanged are passed in, and actually live on the main form. The main form was doing the work and populating the progress bar with progress values and text updates. I then continued to use that custom Progress Bar form in other applications.
For those with some experience in C, you can think of C# delegates as C function pointer typedefs that are memory-safe and have more functionality (for example, invoking the method dynamically).
You're a wonderful teacher m8! It's a subject way beyond of what we're currently learning in college but I wanted to give a try beforehand and WOW!!!! Up until Func/Actions I totally got it all then I kinda got lost but I know the 'clicking' moment is not far!!! Thank you!
I recently picked up on Delegates because I was looking for a solid foundation for an event system for my text adventure game. It works pretty well so far. Some better file management and I could reuse it for future games.
I am amazed how much power there is in C# and Visual Studio, but because I don't know about these concepts I am not getting the full benefit from them. Thank you very much for demonstrating these concepts.
Tim, when i use C2, i get the thing a bit differnet. like as of now 17:10 i get an output like The subtotal is ? 22.93 The total for the cart is ? 20.64 i am not getting the dollar symbol. Why does that happen? How to overcome it?
i'm just at 17:22, and i totally GET delegates and how useful it is for call back. Good stuff! :) 46:12 - awesome-ness delegate and anonymous methods in full glory
This reminds me of the AddressOf operator in VB6, which I implemented a few times. It also reminds me of how we used to declare and raise events in VB6. Good memories.
No BS, I watched this video 5 days ago and used my knowledge to answer an in person interview question today!! Thanks Corey!
Awesome! Good luck on landing the job. Glad I could help.
This is for me:
Example: 1:50
What is a delegate?: 7:52
Func delegate: 18:19
Question: 30:55
Action delegate: 34:00
In line delegates (on the fly): 38:04
WinForm UI: 49:22
WinForm UI with In line delegates: 58:37
Ignoring Action delegate: 1:00:52
When using delegates?: 1:02:15
Nice!
nicee
I recently switched companies and therefore my Java hat to a C# hat.
The quality and information these videos provide is insane. Keep up the good work!
Thank you!
Okay, you are officially the first and only good tutorial I have ever seen on delegates. My issue has always been "Why?". Because I understand what delegates do but never understood why I would go through the trouble of setting them up. This shed light on everything! You're the only one to show how delegates can essentially carry the value of a method and make it transferable to different UI's without having to change very much.
Thank you so much for putting the time into these videos! I hope I can be a better developer by using this to my advantage because not even people I work with could give me this explanation.
Glad it was helpful!
Agreed, that's the problem with 99% of tutorials about this. They always approach it from the purely technical side of things, basically just "it can do this and this and this", which just makes it confusing and annoying. Only when seeing it implemented and applied to an actual problem a developer may face does it actually "click" and become relevant.
@@roydonk2878 very true, though, that's the problem with most tutorials about any abstract subject.
Oddly enough I originally went to college to be a researcher in physics and that sort of issue happens constantly when learning math. "This is what this equations does. Memorize it. Look, *writes out equation and solves it in minutes* its so easy."
I really appreciate videos like this and the people who make them because it has become apparent that teaching (like actual teaching) is a skill not everyone can learn. There are lots of "teachers" in the world and yet so few who are actually able to teach. I'm thankful Tim is someone who can actually teach a subject instead of just reading the definition out load.
I cannot thank you enough for the extremely resourceful content you put on RUclips for free. You are a exceptional Teacher and great developer. I almost always recommend your content to my co-workers and try to follow your best practices in my daily work.
You are welcome.
Wait... you can get hired as a c# dev before knowing delegates?
@@Lanthiren Yes you absolutely can, even at the best companies like Microsoft. Talking about entry level positions of course though
Tim, you have completely changed the way I look at Delegates. The tutorial was easy to understand and I can't thank you enough for the kind of example that you picked up. I have went over numerous videos on this topic and I'm relatively new to C# but your presentation skills were so to the point that I was able to bridge the gap pretty easily. Please continue making great tutorials like these! I kept on running from delegates before watching this video
I am glad it was helpful.
Its the hardest thing about learning new or advanced areas in coding, is that the simplicity of the example environment, obscures the usefulness of the new tool.
That is where practice helps. Trying out what you are learning can reveal what you missed or what was not taught. Then you know the right questions to ask to go deeper.
Comparing delegates and interfaces is one of the best explanations I've come across so far.
Glad it was helpful!
Thank you so much for all the hard work you put into making this content. Seriously one of the best, if not THE best C# tutorials I've found so far.
You are welcome.
Best C# teacher hands down anywhere. Thanks Tim!
You are welcome.
This must be the best video on delegates I came across so far.
Great!
Hi Tim, just let you know that your lessons are becoming an important part of my life, I spend 2 or 3 hrs on listening to them and I love them. Thank you!
Awesome! I'm glad you are finding them valuable.
Very good explanation, I've programmed in C++ for a long time and when you showed the first example it clicked right away. Didn't even notice before that delegates are the same as function pointers for an example in C++
I am glad it was so helpful.
I love the way you explain things. Delegates have been a closed book for me until now. Now I get it.
Excellent!
Finally I have started to understand delegates and their usage. Thanks Tim!!
Awesome!
Tim Corey is a national treasure. Prove me wrong.
Thanks!
- The best explanation of Delegate.
- The best part of this video is that the focus is on details and that is where the devil lies.
- Keep up the good work Tim Corey. :)
Thank you!
Thanks! You are the best 🌹
Thank you!
The last part that winform was connected to the function that uses delegate was the best part. Thank you for your contribution.
Glad it was helpful!
Hi Tim,
Your videos are astonishing. I am (re)developing my skills, as I decided to unstick a label which was attached to my person, and which is kinda barrier in my carrier. But first I must tell you that I am watching your tutorials with pleasure not only because they all full of tips and valuable information but you dose them at a well selected tempo. It is nor too slow neither too fast. It requires good attention but repeating more difficult or condensed fragments doesn't annoy you and there is a very good reason why. It is your calm, energetic, bright and clear voice, the voice of a person who is sure of what he is speaking and how work the things he is speaking about.
Programming is my hobby, and I have developed many programs, aside of my everyday job, mainly in Builder C++ but I started with v3.0 and later didn't keep up with progressing technology. When I saw changes implemented in modern C++ standards 14, 17 ... I was a bit "shocked" discovering Pascal within C++ 😂 I was a bit angry and my son told my that my brain processor runs an obsolete operation system which wasn't patched for a very long time. I am plugged into the industrial automation and robotics world (STL, LAD, FBD, SFC, SCL ...) but fortunately I left some IT related ports open so I am able to upgrade my skills. From time to time I used some devices which work on the edge between IT and OT and faced some problem with samples in C#. As long as you do not need to bother much about programming from scratch, and it is enough to adjust and slightly modify provided examples you don't bother much. Currently I develop a bit more sophisticated software which uses Siemens Openness API and I found out that my knowledge must be quickly updated, especially its C# related area.
I was searching for some good resources, bought a book 700 pages book, and then found your channel - IMHO the best one.
Thank you very much.
JK
You are welcome. I'm glad my content has been so helpful. Thanks for sharing.
I've read about delegates in Shildt's book, then in Troelson's book and finally only after this amazing tutorial I get it. Thank you so much!
You are welcome.
Thank you TIm, for these awesome videos. I can learn anything in C# with these videos.
You are welcome.
this video is the ULITIMATE GOAT! thanks Tim, you did it again.
I am glad it was helpful.
Mastered delegates for the first time. Really handy! Helped me to save loads of lines in my unit test. Thanks a lot for a great video.
Awesome! I'm glad this helped.
Hi Tim. It's been five years since I started working as a developer, yet I still find your videos instructive. There are things I thought I understood, but actually didn't and some aspects that were always foggy for me and that now are coming to light. Thanks for your work, your ability to explain sth you've understood is outstanding. I know a lot of developers that really know what they're doing, but when it comes to explain it to someone else, they fail miserably. Thanks again Tim.
I appreciate the kind words.
Very good explanation. The conclusion for me (in this concrete case):
1. GenerateTotal can send "messages" to Main while it process its work.
2. I can write the code for some operation GenerateTotal does.
So GenerateTotal is just a plan, what have to do, but the concrete code is mine.
You are doing great work, one video at a time. Thanks a lot for your videos!
Thank you for the feedback and ecouragement
Thanks Tim to take your time to explain this, is very useful for who is learning C # and for me, of course! Keep on going!
You are welcome.
Thank you sooo much! I never really understood delegates untill now. The videos you create are amazing and very helpfull. Keep up the great work!
Happy to hear that!
Another great tutorial. I'm still a little nervous around delegates and anonymous methods, but going through this tutorial helped so much. Thanks Tim.
Glad it helped!
0:00 - Intro
1:28 - Demo application walk through
7:52 - Explaining and creating a Delegate
18:19 - Func and Action: problems you can solve with delegates
21:37 - Func Delegate: creating and explaining
30:56 - Why to have delegate, if all the work is done elsewhere
34:00 - Action Delegate: creating and explaining
38:07 - Creating anonymous methods: anonymous Delegate
43:08 - Creating anonymous methods: anonymous Func
45:15 - Creating anonymous methods: anonymous Action
49:30 - Using Delegates in other projects: WinForms
58:37 - Using Anonymous Delegates in other projects: WinForms
1:02:15 - Summary
Thanks! I added it to the description.
@@IAmTimCorey You sure did. Typo and all! lol
Through*
@@DoorThief Thanks. English is not my natural language. I try spellcheck everything thou. I slipped up. Sorry.
Thanks, Tim!
Seriously an absolute game changer these here Delegates. I feared I'd have to do some weird two-way event thing to pass a request from the logic layer to the UI layer, and then the eventual user reply back to the logic layer. But this unlocks so many new possibilities for my code.
Awesome!
man you are wholesome, asking is people are financially able
Thank you. My primary purpose is to help people. I definitely don't want people spending more than they should out of a feeling of obligation.
I had to watch it twice to get it. Then was able to implement for a dev for a client. Thanks so much
Excellent! Way to stick with it.
Sir can you please demo me the code with real world example?
man this is such a great tutorial!! very complex topic but made simple by Tim, thank you so much.
You are welcome.
The best explanation so far. In my real life experience those concepts is very hard to implement because the deadline is very tight and the team has no time to think in better design patterns.
They are hard, which is why practicing them to get skilled at them is a big deal. The easier they are to do, the more likely you will be to use them in a real project.
@@IAmTimCorey Sure, you are right. Tks.
Great thanks Tim for such a wonderful masterpiece. I immediately applied it to resolve my issue: when a lower level code needs to refer to a higher level's method, I used delegate to make it loose-coupled. feel amazed. thanks Tim, you're just the best. :)
Awesome!
Come back to say Thanks!! I used the knowledge gain here in my actual work today! Very excited!!
Fantastic! I am glad it was helpful.
Hell yes!! Cant wait to watch it later today. Hope it has func and action covered
yup, he covers that topics too
Excellent. As long as he sticks to his elaboration techniques i will be more than satisfied.
Let me know what you thought of it.
Its awesome. Still a bit of abstract but awesome. Ill watch it till i understand it.
Next up dictionaries? Right? Hehehe.
Thanks Tim. Excellent demonstration. Events and Delegates are no more a grey area to me.
Glad it was helpful!
I don't understand how u are able to reply to every comment but I appreciate your effort, and ur vids are amazing!
I've been falling behind and not getting to every one, but I do my best.
Great explanation. Not to fast and taking me step by step. Thanks. Used lamba expressions for a while now but its always nice to know what they do
I appreciate the kind words.
I just realized that there was an editing mistake.
The video has near-duplicate sections at 49:58 and at 50:23. Threw me off there for a second.
The first duplicate already includes the method "PrintOutDiscountAlert".
The second duplicate the "PrintOutDuplicateAlert" is added.
Very helpful, have read about delegates a few times through the years but never fully understood them until now.
As a long time anti C#-er, I am finally learning to enjoy it.
Awesome! I am glad it was so helpful.
Your tutorials are such a great help! I've never seen any other channel on RUclips that explains C# and .NET as good as you do or as helpfu as you do
Glad you like them!
Thank you so much for the video Tim.
Got clearer picture of Delegates, Func, Action and Lamba expression.
Excellent!
once again, tim corey had the best video on the topic
Thank you.
This was high on my wishlist, can't wait to watch!
Great!
Excellent Tim...keep the good work going.
Thanks!
That's an excellent way of teaching. It's much easier to understand like this instead of reading the concept in book. :)
I am glad you are finding it enjoyable.
The value of delegates (and the realization of how much we already use them) really came to the forefront for me when I developed a WinForms app that had a modal progress bar. The progress bar has a BackgroundWorker, however the methods for DoWork and ProgressChanged are passed in, and actually live on the main form. The main form was doing the work and populating the progress bar with progress values and text updates. I then continued to use that custom Progress Bar form in other applications.
Cool.
Hmm, why not to supply your Progress Bar with just values and text updates, not delegates, it would be even more flexible.
Good videos. I am learning English watching you videos. Thanks.
Thanks!
Значит я такой не один. =) Тим выдает чистую амброзию для ушей.
Perfect! Totally the WOW tutorial about Delegates/Funcs/Actions... Please, make an Expression Tree tutorial following this one... 🙏🏻
I will add it to the list. Thanks for the suggestion.
For those with some experience in C, you can think of C# delegates as C function pointer typedefs that are memory-safe and have more functionality (for example, invoking the method dynamically).
Thanks for sharing.
You're a wonderful teacher m8! It's a subject way beyond of what we're currently learning in college but I wanted to give a try beforehand and WOW!!!! Up until Func/Actions I totally got it all then I kinda got lost but I know the 'clicking' moment is not far!!!
Thank you!
Glad it was helpful.
I recently picked up on Delegates because I was looking for a solid foundation for an event system for my text adventure game. It works pretty well so far. Some better file management and I could reuse it for future games.
Great!
Helped me a lot to understand delegates and their use, thanks a lot man your videos really clarify a lot of the concepts i find confusing about C#.
Great to hear!
you're a genius men, seriously! :) I subscribe instantly
Thank you!
awesome explanation... I will recommend this video to every beginner programmer.
I am glad you enjoyed it.
This is great stuff, I wish I would've seen this a few years earlier but better late then never!!
Thank you!
Thank you! Great tutorial. Clear explanations :-)
You are welcome.
that moment when you've been watching for 40 minutes and he says "in a nutshell" 38:03
lol
You should see the book called "C# 9.0 in a Nutshell" then :) It's > 1000 pages long.
Man, you make difficult things so understandable! You're awesome!
Thanks!
We've waited for this and the wait was more than worth it. I'm bumping up my Patreon donations
i appreciate it.
Thank you for this tutorial. Like your other content, it is comprehensive with theory and practical examples.
You are most welcome. Thanks for watching.
I am amazed how much power there is in C# and Visual Studio, but because I don't know about these concepts I am not getting the full benefit from them. Thank you very much for demonstrating these concepts.
You are welcome.
i had the OHH YEAH moment when you create the subtotalalert method, thanks for this vid
Glad it helped!
Very good explanation this really helped me to make my application more flexible.
Excellent!
Thanks a lot Tim. You are really making learning c# simpler. Thanks.
You are welcome.
As always, very helpful and well-structured content. Big thanks!
You are welcome.
Extremely well laid out and comprehensive! Thank you!
You are welcome.
I am enjoying even the comments, great discussions here awesome environment. Cnt wait for the next one!!!!
Excellent!
This was quite helpful, thank you very much Tim!
You are welcome.
Hi Tim. I hope you feel better soon. I miss your lessons and wish you a good health.
I'm finally getting better. New videos are coming soon.
Great lesson Tim, thank you.
You are welcome.
Again, excellent and simply explained. Thank you.
Thank you for investing time with Tim's videos.
Thank you for this video. Took 2 viewings before it sunk in...but persistence pays off.
Thanks for hanging there. Rarely can we pick up all of it in one pass, because there is just too much great info.
Figured out it is just a function pointer within the first 10 minutes. Thanks.
You are welcome.
very good tutorial love way of teaching why we need and when we should use
Thank you!
Thank you for this very tutorial and other tutorials!! They give me a lot of insight into c#
Thanks for trusting and building your skills with Tim
Your channel is awesome, this helped me so much!! Thank you so much!!
You are welcome.
Tim, when i use C2, i get the thing a bit differnet.
like as of now 17:10 i get an output like
The subtotal is ? 22.93
The total for the cart is ? 20.64
i am not getting the dollar symbol. Why does that happen? How to overcome it?
Its really "in a nutshell" about delegates. Great stuff 👍
Glad you enjoyed it
i'm just at 17:22, and i totally GET delegates and how useful it is for call back. Good stuff! :)
46:12 - awesome-ness delegate and anonymous methods in full glory
I'm glad it was helpful.
Wonderful and simple. Love your work!
Thank you so much!
Thank you for sharing your time and knowledge, you are doing a great job, God bless you!
You are welcome.
Excellent explanation. Just subscribed to your Patreon site
Awesome, thank you!
thanks for free lectures.
You are welcome.
Well done. You explanation is clear like a diamont :-)
Thanks!
I remember your video about the concept of interface so much that I could relate it with delegates.
Great!
Great video, nice and clear! Looking forward to the Async video / threading video.
Thanks!
Was fuzzy on some of the details, this cleared everything up. Thanks.
Excellent!
Danke!
Great work.
Thank you!
It took time but I came across the ohhh yeah moment. Thanks!
Please share the time stamp of that point in the video and what the topic that became clear. It could help other viewers.
This reminds me of the AddressOf operator in VB6, which I implemented a few times. It also reminds me of how we used to declare and raise events in VB6. Good memories.
Yeah, delegates are really close to events (events are a type of delegate).
At 1:04:35 shouldn't it be "Dashboard inherits from Form" instead of "Form inherits from Dashboard"?
Yes that is clearly what he meant to say
It's very Great Explanation.. wonderful, Thx a lot sir
You are welcome.
Holy fk if i had u as my teacher in school i would have called Bill Gates my employee by now. Keep up the good work.
Thanks!
Great video, Tim!
Already subscribed to you blog. I'll take a deeper look into the courses you sell.
Thanks a lot!
You are most welcome. Thanks for watching.
You are my new best friend!!!!
HaHa! Excellent!