In what kind of situation people use delegate


i know when pass function function argument use delegate.

when define event use delegate know other situation exist when people use delegate. please discuss many situation sample code.

i want know few real usage of delegate can not move without delegate.

thanks

i tell students 4 (4) main ways use delegates are:

  • single-cast delegate points single method
  • multi-cast delegate helps form invocation list chaining delegates together
  • asynchronous programming using begininvoke()/endinvoke() methods following asynchronous programming model (apm)
  • they form basis of events

in c#, every event based on delegate.

the popular delegate in use eventhandler delegate. it's included .net. responsible event handlers pattern of:

private void <ctrl>_<event>(object sender, eventargs e) { }

https://msdn.microsoft.com/en-us/library/system.eventhandler

remember - delegates 1 of 5 types of types can define in c#. list includes:
class, struct, interface, enum, , delegate.

good luck!


best wishes, davin mickelson



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user