Proper naming convention for a .NET Delegate type?
Personally I use a couple of different patterns:
[Task][State]Handler
- UITaskFinishedHandler
[Event]Handler
- ControlLoadedHandler
[Function Name]Delegate
- DoSomeWorkDelegate - used when I need to create a delegate for calling a function on a different/new thread
[Task]Callback
- ContainerLoadedCallback - used when control A starts an action which control B does most of the work and control A has passed a dependency in to control B (i.e. ControlA may have passed a UI container for ControlB to fill and needs notification to actually show the container)
When you have a project that uses a lot of multi threading or async WCF calls you can end up with a lot of delegates floating around, so it is important to adopt a standard that at least makes sense to you.
Microsoft's Framework Design Guidelines - the naming almanac for me, says the following on the topic:
√ DO add the suffix "EventHandler" to names of delegates that are used in events.
√ DO add the suffix "Callback" to names of delegates other than those used as event handlers.
X DO NOT add the suffix "Delegate" to a delegate.