Reading from MSDN: "A delegate is a type that references a method. Once a delegate is assigned a method, it behaves exactly like that method."
Does then "delegate" mean a type or an object?!
...It cannot be both. It seems to me that the single word is used in two different meanings:
- a type containing a reference to a method of some specified signature,
- an object of that type, which can be actually called like a method.
I would prefer a more precise vocabulary and use "delegate type" for the first case. I have been recently reading a lot about events and delegates and that ambiguity was making me confused many times.
Some other uses of "delegate" word in MSDN in the first meaning:
- "Custom event delegates are needed only when an event generates event data"
- "A delegate declaration defines a class that is derived from the class System.Delegate"
Some other uses of "delegate" word in MSDN in the second meaning:
- "specify a delegate that will be called upon the occurrence of some event"
- "Delegates are objects that refer to methods. They are sometimes described as type-safe function pointers"
What do you think? Why did people from Microsoft introduced this ambiguity? Am I the only person to have conceptual problems with different notions being referenced with the same word.