Events are basically actions raised by an object when some condition met.
Like In stock class there is a property named Limit, and it raised an notification when it reaches certain limit. This notification is done by events
Delegate is more generic term which is similar to a pointer to a function.
They are generally used as a input parameter. In particular they are perfect way to implement Strategy pattern. For example, if I want to sort a List of objects, I can provide a Compare strategy to the method to tell the implementation how to compare two objects.
Like In stock class there is a property named Limit, and it raised an notification when it reaches certain limit. This notification is done by events
Delegate is more generic term which is similar to a pointer to a function.
They are generally used as a input parameter. In particular they are perfect way to implement Strategy pattern. For example, if I want to sort a List of objects, I can provide a Compare strategy to the method to tell the implementation how to compare two objects.
Very nice article.... Thanks
ReplyDelete