How to name an event handler of a private variable in Vb.Net following FxCop rules and Vb.Net standa
Posted
by SoMoS
on Stack Overflow
See other posts from Stack Overflow
or by SoMoS
Published on 2010-04-22T14:56:35Z
Indexed on
2010/04/24
21:53 UTC
Read the original article
Hit count: 300
Hello,
On one side, in Vb.Net when you add an event handler to an object the created method is named: <NameOfTheObject>_<NameOfTheMethod>
.
As I like to have consistent syntax I always follow this rule when creating event handlers by hand.
On the other side when I create private variables I prefix them with m_ as this is a common thing used by the community, in C# people use to put _ at the beginning of a variable but this is no CLS compliant.
At the end, when I create event handlers for events raised by private variables I end with Subs like m_myVariable_MyEvent. Code Analysis (Fx Cop) is complainig about this way of naming because the method does not start with uppercase and because the _, so the question is:
What naming standards do you follow when creating event handlers by hand that follow the Fxcop rules if any?
Thanks in advance.
© Stack Overflow or respective owner