Recommendation 137: Delegate and event types should add ancestor suffixes
The delegate type itself is a class, considering that the name of the derived class is suffixed with the base class name. The event type is a special kind of delegate, so the event type also follows this recommendation.
The proper naming methods for delegates and events are:
Public Delegate voidHttpcontinuedelegate (intStatusCode, System.Net.WebHeaderCollection httpheaders); Public Delegate BOOLValidatevaluecallback (Objectvalue); Public Delegate voidAsyncCallback (IAsyncResult ar); Public Delegate voidPropertychangedcallback (DependencyObject D,dependencypropertychangedeventargs e); Public Delegate voidMouseEventHandler (Objectsender, MouseEventArgs e); Public Delegate voidSizechangedeventhandler (ObjectSener, Sizechangedeventargs e); Public Delegate voidUnhandledexceptioneventhandler (Objectsender, UnhandledExceptionEventArgs e);
In the traditional way, we may not see these types as having a base class, but the keyword delegate and event for delegates and events already indicate that the base class of the latter type is delegate. The delegate is divided into delegate end and callback end according to the function of the delegate type, we must pay attention to distinguish this point when declaring the delegate. If the delegate is used for the callback nature, the callback end is used.
The naming of the delegate and the event is inappropriate, that is, the type is not visible from the name, as follows:
Public Delegate void DoSomething (intint b); Public Delegate void MouseClick (intint b);
Turn from: 157 recommendations for writing high-quality code to improve C # programs Minjia
"Go" writing high-quality Code 157 recommendations for improving C # programs--Recommendation 137: Delegate and event types should add ancestor suffixes