What is the real daily-use for a delegate or an event? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the real daily-use for a delegate or an event?

Im having a lot of issues trying to fit those concepts into my everyday tools.

6th Feb 2017, 8:03 AM
Gianfranco D'agostino
Gianfranco D'agostino - avatar
1 Answer
+ 1
events in programming language is similar to daily life events. for example when some learn speeks, write first word being graduate is big events of life. similarly in programming language event occur when something cahnges. say when someone click on screen or press some key is event. now what is delegates and how to use them? in c# we called callback function a delegate. now what the f**k is this callback function. callback function is just a pointer of the function. now the question is why do we need these delegates? the reason is, when some event occurs we have to perform some task? right. to perform operation we have to write code of block (function) and register our function's pointer with event so whenever event go triggered it will call our function and the code that you wrote in delegate (callback function) will get run
25th Mar 2017, 11:14 AM
Keshave Jat
Keshave Jat - avatar