Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Delegation - Is my understanding correct?

$
0
0

Hi guys,

I've been programming for years but I've never really used delegation but I've seen it in Microsoft's code, etc.

I've read a few guides, documents, etc on http://msdn.microsoft.com - which is a brilliant source of info.

Even though I've read it through and through, I still don't think I understand it's usefulness. Mainly because there seem to be different variations which make it more confusing.

My understanding of delegation is simply:

A delegated method is a method which is run but not to the detriment of the proceeding methods. It needs to be done but it's not allowed to disrupt the flow of other tasks. We want that task done but don't come back and give us updates. We are carrying on with our tasks - just deal with that task.

For example, serving ice cream:

get cone

get tissue

wrap tissue around cone

put ice cream in cone

clean off spills - DELEGATE

refill cone stock if low - DELEGATE

hand cone to customer

charge customer

put money in till

The two delegates, they are important and we do want them to be done, but we don't want them to interfere with handing the cone to the customer and charging and putting money in the till. So delegation is technically threading?

Have I got the correct understanding of this?

Thanks, Antony


I'm a Compsci student


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>