After reading the article- When to Use Delegates Instead of Interfaces (C# Programming Guide), I need some help understanding the below given points, which I found to be not so clear (for me). Any examples or detailed explanations available for these?
Use a delegate when:
- An eventing design pattern is used.
- It is desirable to encapsulate a static method.
- Easy composition is desired.
- A class may need more than one implementation of the method.
Use an interface when:
- There are a group of related methods that may be called.
- A class only needs one implementation of the method.
My Questions are,
- What do they mean by an eventing design pattern?
- How the composition turns out to be easy if a delegate is used?
- if there is a group of related methods that may be called,then use interface-What benefit it has?
- if a class only needs one implementation of the method, use interface-how is it justified in terms of benefits?