Delegates

Use Delegates to handle events smartly.

We often come across the need to encapsulate a method inside an object. We do it sometimes because we need to pass it inside another method or class instantiation. A delegate can invoke any method that aligns with its signature and the return type.

Delegates accommodate the feature to execute methods at runtime even when you do not know what those methods are at compile time.

Share