Net-informations.com
SiteMap  | About    

Do events have return type

Firing an event is a one-way signal. By default most event handlers return void , because single event may have several subscribers, and return value could become ambiguous. However, it is possible for handlers to return values. Simple delegates may have any return type. Just treat them as methods that are resolved at the run time. It depends on the type of the delegate you declare the event with.

What is an Event ?

Events enable a class or object to notify other classes or objects when something of interest occurs. The class that sends (or raises) the event is called the publisher and the classes that receive (or handle) the event are called subscribers .

What is a Delegate ?

A delegate is a reference to a method. Just like you can create a reference to an instance. It is a form of type-safe function pointer used by the Common Language Infrastructure. You create a delegate with the delegate keyword, followed by a return type and the signature of the methods that can be delegated to it.

Delegate with return type

More about.... Delegate in .Net









net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.