Christian Heide Damm <ch*****@microsoft.com> wrote:
One way to look at a delegate is that it's an interface with one method.
If your sorting class needs just one method to determine the order of two
objects, then you can use a delegate for that.
Indeed, "interface with one method" is how I often think about it too.
There are a few important differences though:
o Delegates can be multi-cast. This allows events to be subscribed to
by multiple delegates, effectively. (This could be done with a list
of interface implementations, of course.)
o You can specify any appropriate method for a delegate - it doesn't
have to use a specific name, unlike interfaces (in C#, anyway)
o The method can be static
o The method can be private
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too