C# Delegates & Lambdas Explained

  Рет қаралды 39,620

Raw Coding

Raw Coding

Күн бұрын

Пікірлер
@RezaERabbyRER
@RezaERabbyRER 3 жыл бұрын
This channel deserves more subs. Such a nice and underrated guy he is!
@RawCoding
@RawCoding 3 жыл бұрын
Thanks, we’ll get there
@mikhailkh8560
@mikhailkh8560 3 жыл бұрын
Man - you make things so clear with one single sentence - "delegates is kind interface of function". Awesome, I search for it literally a years! Now it so simple!
@RawCoding
@RawCoding 3 жыл бұрын
Glad I could help)
@yanhuang4911
@yanhuang4911 6 ай бұрын
He explained it in the Java way ,before lambda expressions was introduced, anonymous functions are written as implementations of interface
@limitless6572
@limitless6572 2 жыл бұрын
I want to master c# and i did strugle with delegates, but you made it so simple, many thanks dude
@seanrendall5495
@seanrendall5495 2 жыл бұрын
This helped me wrap my head around delegates, thanks a lot!
@RawCoding
@RawCoding 2 жыл бұрын
glad I could help!
@MrAdamkimbo
@MrAdamkimbo 3 жыл бұрын
I learned a great deal from this. You're providing a great service with this channel. Many thanks!
@RawCoding
@RawCoding 3 жыл бұрын
Cheers
@АйдарИльясов-т3ы
@АйдарИльясов-т3ы 2 жыл бұрын
Спасибо большое, наконец-то понял делегаты. Очень хорошие объяснение сравнивая как было и как код стал лучше с делегатами. Иногда смотрю твои стримы тоже, очень познавательно. Спасибо за твое творчество.
@RawCoding
@RawCoding 2 жыл бұрын
Спасибо, рад что мог помочь)
@kpro9047
@kpro9047 3 жыл бұрын
Thanks for this. I really appreciate your teaching method. I am an advanced beginner trying to get to the next level. I found your video to be super clear and to have just the right amount of background detail to fill in the gaps in my understanding of basics.
@RawCoding
@RawCoding 3 жыл бұрын
Nice 👍
@sivasankaria1090
@sivasankaria1090 3 жыл бұрын
It really helps to understand the delegates in better way.. Thanks for that. Need Lamda tutorial in advanced manner like this .... :)
@RawCoding
@RawCoding 3 жыл бұрын
Cheers and I mean we kinda dissected the lambda as well
@sivasankaria1090
@sivasankaria1090 3 жыл бұрын
@@RawCoding Why cann't u get deeper into firebase and its tech with angular ?
@RawCoding
@RawCoding 3 жыл бұрын
I hope it doesn’t come as a surprise, but just because I do tutorials on tech that I know, that doesn’t mean I know everything. I don’t use angular and I don’t understand why other do, vuejs is so much better. As for firebase, I know a little bit so you can expect some content about it.
@Gazda99
@Gazda99 3 жыл бұрын
Wow this is very good job, first video about delegates when someone finally describes it in a easy but accurate way. Keep doing that :D
@RawCoding
@RawCoding 3 жыл бұрын
Thank you, glad you like it )
@apofisz1
@apofisz1 3 жыл бұрын
it is the best delegate video ever!
@RawCoding
@RawCoding 3 жыл бұрын
Cheers
@ivanvincent7534
@ivanvincent7534 2 жыл бұрын
Understand delegates, generic delegates, anonymous functions, lambdas and a general sense of the complexity hidden in IL. However the last 3 minutes on what is a closure wasn't clear for me.. Thanks for your content.
@RawCoding
@RawCoding 2 жыл бұрын
Closure is a variable in the lambda which comes from the outside, if you mark a lambda to be static closure won’t be allowed .
@mebtuabebe8428
@mebtuabebe8428 2 жыл бұрын
Delegates put right! This tutorial would have been the answer if i had asked delegates what they really are.
@RawCoding
@RawCoding 2 жыл бұрын
Glad I could help 👍
@Asurow
@Asurow 2 жыл бұрын
Out of all the video in youtube about interface and delegates. I mangaged to differentiate and undestand clearly from this video. Should include interface in the video name. Thank you.
@leafarlua
@leafarlua 3 жыл бұрын
Your content is amazing... And there is so much! Thank you a lot, it really helped me understand better what are delegates.
@RawCoding
@RawCoding 3 жыл бұрын
Glad to hear
@danurarya0823
@danurarya0823 Жыл бұрын
Thanks, this video help me understand better about delegate
@thiswallz
@thiswallz Ай бұрын
found this gem, starting to believe again on youtube
@SaveTheHedgehog
@SaveTheHedgehog 2 жыл бұрын
what setting do you use that transforms the => to an arrow (symbol)? do they call it fira code?
@RawCoding
@RawCoding 2 жыл бұрын
They are called ligatures and are usually built in to the font you use, I use JetBrains Mono
@SaveTheHedgehog
@SaveTheHedgehog 2 жыл бұрын
@@RawCoding aha, thanks. I will figure it out.
@vuongvu5134
@vuongvu5134 3 жыл бұрын
How do you enable to auto-generate of the interface implementation. Also to change the color coding of the interfaces/classes to be blue (mine is white)? Also I'm not getting the references appear for my classes/methods?
@RawCoding
@RawCoding 3 жыл бұрын
Payed version
@sunnypatel1045
@sunnypatel1045 3 жыл бұрын
Mate I watched many videos this week and this is flawless ! Thank you
@RawCoding
@RawCoding 3 жыл бұрын
Thank you)
@StreetBladerBloke
@StreetBladerBloke 3 жыл бұрын
Super technical explanation..thanks for sharing
@RawCoding
@RawCoding 3 жыл бұрын
Thank you for watching
@arash2229
@arash2229 4 ай бұрын
Nice explanation. ty buddy 😊❤
@stefanioan7569
@stefanioan7569 3 жыл бұрын
is the F12 option available only for the paid premium version?
@RawCoding
@RawCoding 3 жыл бұрын
Think so,it’s called IL spy and you can get it on visual studio
@stefanioan7569
@stefanioan7569 3 жыл бұрын
@@RawCoding I did open ILSpy it with alt+shift+r. Thanks for support and all the hard work
@oladipotimothy6007
@oladipotimothy6007 3 жыл бұрын
How do you get this good? How do you practise to sharpen your skills
@RawCoding
@RawCoding 3 жыл бұрын
Google read write review repeat
@oladipotimothy6007
@oladipotimothy6007 3 жыл бұрын
@@RawCoding I will have to stamp that on my wall
@rajenlenka7806
@rajenlenka7806 3 жыл бұрын
Only 60 Percent Gratitude This Time ...+5 for Keepin interest ... :) ...I will try again :)
@RawCoding
@RawCoding 3 жыл бұрын
Cheers
@apofisz1
@apofisz1 3 жыл бұрын
in this example how can i use += ? how can i add more methold with +=?
@RawCoding
@RawCoding 3 жыл бұрын
Yea, haven’t really covered it in the video. That’s essentially function composition and you just have to keep matching the signature of the function. You can also call the Combine method on the delegate
@mohammadzakareatfaili9566
@mohammadzakareatfaili9566 3 жыл бұрын
Great course specially when digging into real code generated thanks a lot. Could you please provide real world example not several video series, I always understand the concept but when coding I don't know where to apply specially in delegates and threading.
@RawCoding
@RawCoding 3 жыл бұрын
Func Factory You can have a parameter like that which will create a fresh instance of an object each time it needs it, and you can supply different creation processes.
@mikhailkh8560
@mikhailkh8560 3 жыл бұрын
Delegates is a great thing, but not all tasks require to use it. There are plenty of topics where you could solve your thing with interfaces. Any way for real examples - google for observer pattern in C#. Also i found this wery useful with view-controller concept where you inject function of controller inside view. For example one class describe form with a button - viewer, another class contains function which should be invoke when user click. And you could use same form with many controllers, or you could replace controller, or test controller without interface, cause both are indepent - google for dependency injection.
@Sindrijo
@Sindrijo 2 жыл бұрын
Hi there, great video. I have a question for you. I've been trying to find examples an actual practical use delegate combination (outside of subscribing to an event) but I haven't been able to which makes me think it is just an inherited/extra feature of how the language designers wanted the event subscription syntax to be (+= and -=). I don't think I've ever seen an example in real-life code where a delegate is passed around as an argument and other delegates are added to it. I can sort of imagine it happening in some builder-pattern, maybe, but that is still a long shot, the delegate only allows you to add/remove from the delegate queue and invoke it. Do you have any examples where delegate combination / multicast delegates (outside of events) would be a useful, readable, desirable way to write code? To me, the fact that a delegate can be turned into a multicast delegate at any point, is kind of scary, I've always treated them as just a 'function pointer' and not a 'container with possibly multiple function pointers'.
@RawCoding
@RawCoding 2 жыл бұрын
it's used for the Observable pattern, other than that nobody really uses it for anything else. also I prefer to just have the IObservable interface
@facejets
@facejets 3 жыл бұрын
If you're saying "marginally" at around 11:40, you have the wrong definition for "marginal". To soften the blow, I'll point out that these first-class function doohickeys are finally starting to click for me. Thanks! Subscribed immediately.
@RawCoding
@RawCoding 3 жыл бұрын
Aha yes, the word should be drastically cheers :D
@stefanbogdanovski7678
@stefanbogdanovski7678 3 жыл бұрын
This is a great content and you represented it very well! If I may ask for your opinion, what would be the most wanted skills for a .NET full stack postion? Cheers!
@RawCoding
@RawCoding 3 жыл бұрын
- attitude to learn - if they don't know .net or any other tech that's part of the "full stack" they can just learn it. This can be shown by trying a lot of different things, or personal projects, some kinds of participation in the community. - problem solving skills - this knowledge is transferable between all parts of life and abstract enough to mean if you are good at problem solving in 1 area, you are most likely going to be as good in another once you learn the basics. This is quite hard to gauge in people, but is generally a skill that you learn throughout life; computer companies sometimes just hire Maths and Physics graduates because the problems they solve are a lot harder than the ones we programmers face.
@stefanbogdanovski7678
@stefanbogdanovski7678 3 жыл бұрын
Thanks a lot!
@tisurmaster
@tisurmaster 3 жыл бұрын
delegates, interfaces, abstract classes, polymorphism.. oh my!
@RawCoding
@RawCoding 3 жыл бұрын
It’s an illusion
@yoosufriffath6284
@yoosufriffath6284 3 жыл бұрын
umm.. I don't think the return type is actually considered as a part of the method signature? I could be wrong lol..
@RawCoding
@RawCoding 3 жыл бұрын
It is for the purpose of comparing delegates.
@BasiliskSupreme
@BasiliskSupreme 2 жыл бұрын
Hey thanks man . Probably one of best tutorials to understand delegate - especially the behind the screen - nuts and bolts. Quick question though: Lets say I have a second method Main() which is overloaded, then I get a run-time error as the Delegate is not able to resolve which lambda function to target. How do you fix this? I tried using the parameters of GetMethod() but no avail . Please help !!
@PivaWillianS
@PivaWillianS 3 жыл бұрын
Just to be technical about it the return type isn't part of the method's signature, but besides this really good video.
@RawCoding
@RawCoding 3 жыл бұрын
It is not! Thank you
@hugebug4ever
@hugebug4ever 2 жыл бұрын
Very clear, Thanks~!
@danielchoo5560
@danielchoo5560 2 жыл бұрын
Hi, it is great tutorial. Would like to request have a tutorial regarding UI Thread, Window Form Control Method Invoke and etc.
@RawCoding
@RawCoding 2 жыл бұрын
You’re welcome and no ty
@josephbloggs2477
@josephbloggs2477 9 күн бұрын
Stopped at 6:30 . Going around in circles.
@oleksand.d
@oleksand.d 3 жыл бұрын
Suggestion for the next video explanation - expression, expression tree and other related staff. Interesting to know your self specific explanation :)
@RawCoding
@RawCoding 3 жыл бұрын
I’ve already covered this topic, check the playlist
@oleksand.d
@oleksand.d 3 жыл бұрын
@@RawCoding I missed it! Thanks))
@RoboChickenAnimation
@RoboChickenAnimation 3 жыл бұрын
can you make a video on error handling in C#? Thanks.
@RawCoding
@RawCoding 3 жыл бұрын
What’s your concern with error handling?
@RoboChickenAnimation
@RoboChickenAnimation 3 жыл бұрын
@@RawCoding how to elegantly throw and handle exceptions in a way that avoids them being raised everywhere making code harder to read and trace through. Thanks.
@RawCoding
@RawCoding 3 жыл бұрын
Avoid exceptions
@RoboChickenAnimation
@RoboChickenAnimation 3 жыл бұрын
@@RawCoding I’ve heard this a few times. Could u send me a link to anything that would steer me in the right direction I’d very much appreciate it!
@RawCoding
@RawCoding 3 жыл бұрын
Just don’t throw exceptions. Handle unexpected ones in business critical paths
@farmanguliyev
@farmanguliyev 3 жыл бұрын
The concept is very easy.
@RawCoding
@RawCoding 3 жыл бұрын
Not for everyone
@elan2199
@elan2199 3 жыл бұрын
Not 4 me. I'm dumb af lul.
@amjad-se
@amjad-se 3 жыл бұрын
Not 4 me either :)
@sunilanthony17
@sunilanthony17 3 жыл бұрын
Delegate is a container that a function(lamda) goes into => Awesome();
@RawCoding
@RawCoding 3 жыл бұрын
Awesome indeed )
@abcz___hello
@abcz___hello 11 ай бұрын
thank you
@haythambiadse5137
@haythambiadse5137 2 жыл бұрын
you are red hot chili pepres in word of coding channels
@isachells9859
@isachells9859 3 жыл бұрын
Thx
@RawCoding
@RawCoding 3 жыл бұрын
Np
@XpLoeRe
@XpLoeRe 3 жыл бұрын
this is fucking amazing
@RawCoding
@RawCoding 3 жыл бұрын
No you are!
@mfundofalteni2620
@mfundofalteni2620 3 жыл бұрын
Delegates are basically stored procedures for c# 😅
@RawCoding
@RawCoding 3 жыл бұрын
Ohhh man don’t know about that one, that’s a bold statement
@clearlyunwell
@clearlyunwell 3 жыл бұрын
👍🏽
@RawCoding
@RawCoding 3 жыл бұрын
)
@Raid77
@Raid77 Жыл бұрын
20:10
@PaulSebastianM
@PaulSebastianM 3 жыл бұрын
Beach... haha. 😅 pandemic side-effects.
@RawCoding
@RawCoding 3 жыл бұрын
I miss it 😿
@stewiegriffin6503
@stewiegriffin6503 2 жыл бұрын
u are very confusing
@RawCoding
@RawCoding 2 жыл бұрын
Eyyy Stewie how you doing
@tuberklz
@tuberklz 3 жыл бұрын
wtfunc
@RawCoding
@RawCoding 3 жыл бұрын
Exactly
C# Generics Explained
36:01
Raw Coding
Рет қаралды 16 М.
Why is C# Evolving This Way?
15:02
Zoran Horvat
Рет қаралды 23 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
What are Delegates? (C# Basics, Lambda, Action, Func)
18:39
Code Monkey
Рет қаралды 304 М.
C# Async/Await/Task Explained (Deep Dive)
24:22
Raw Coding
Рет қаралды 423 М.
Delegates in C# - A practical demonstration, including Action and Func
1:09:11
Introduction to C# Delegates and Lambdas
37:42
Rainer Stropek
Рет қаралды 15 М.
Every single feature added in C# 11
27:07
Nick Chapsas
Рет қаралды 112 М.
Semaphore Explained C#
12:24
Raw Coding
Рет қаралды 42 М.
The Ultimate Guide to C# Records
12:55
Zoran Horvat
Рет қаралды 23 М.
Delegates, Events, Actions and Funcs - The Observer Pattern (Unity & C#)
11:48
What is Span in C# and why you should be using it
15:15
Nick Chapsas
Рет қаралды 262 М.
Andrew Kelley   Practical Data Oriented Design (DoD)
46:40
ChimiChanga
Рет қаралды 149 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН