We can call callback methods using delegates. For eg,
public delegate bool ContinueProcessing();
// later in code we can write ,
ContinueProcessing cp = new ContinueProcessing(IsDataAvailable);
cp += new ContinueProcessing(IsTransactionComplete);
//later in code defination of methods
bool IsDataAvailable() { return true; }
bool IsTransactionComplete() { return true; }
cp.Invoke() ;
The above call will call two boolean method one after the other. Why we need "Events" ? What is the purpose of "Events" ?