If you represent C # without delegates, you usually come across situations where you have classes or interfaces with one method. The name of this method is redundant. eg.
public interface IGetMail { Mail JustGetTheMail(); }
This interface uses one method. A reference to an object of this type is really nothing more than a reference to a single method being called. Caller Code:
Mail m = getMail.JustGetTheMail();
can be reduced to:
Mail m = getMail();
The compiler can do this as โsyntactic sugarโ without any ambiguity, because there is only one method that you could call in this getMail link.
So add this function to our C # compiler. Now, when we declare these types, we could do it a little more accurately. We do not need to specify the name of the method when calling, so why should we first specify the name method?
Choose the name of the standard method, Invoke , i.e.
public interface IGetMail { Mail Invoke(); }
We will add some more syntactic sugar so that we can write this as:
public delegate Mail GetMail();
Hey presto. We have added delegates to our C # compiler.
(Technically, the CLR also knows about delegates, and instead of generating an interface, the C # compiler generates a special type of "delegate" that supports asynchronous invocation and manipulates an immutable list of delegates and treats them as a single reference, but this could be done in basic form with interfaces. There is a suggestion to do this for Java).
Then we can go further and add anonymous delegates - make them compressed for implementation so that the interfaces are not.
So, to answer your question - at any time when your interface has one method, it can be a delegate, and you can seriously reduce the amount of unnecessary code that you have to write.