I have learned delegate in dotnet that is referencing any function.
What does it mean by event coceptually? Is it any reference ? It has a middle layer and use delegates internally. But, what is that middle layer ?
Actually, what can we do using event ? or Why should we use it ?
Why does event has no return type ? Why is it public by default ?
I think of an event as a collection of delegated methods. You can subscribe as many event handlers to an event as you want.
You create an event when you want to expose a point in your code that someone can “inject” operations. For example, let’s say you have a class that is responsible for processing an order. You may want to expose an event called “OrderProcessed” and in the future someone who is using your order processing class could “hook up” to the OrderProcessed event to do something like send a confirmation email. Because the event is a delegate type, you can specify that all methods subscribing to the event expect to receive a parameter that contains your “Order” type
Example: