Hi,
When I code i use underscores in variables, such as m_sString. m for member and s for string followed by the name. I use this i class names and in namespaces as well.
I have started to use FxCop to analyze my code and it complains on my underscores with the phrase: Identifiers should not contain underscores.
Questions:
1. Does anyone knows why I can't use underscores
2. What will happen if I use underscores
3. Does anyone have another suggestion for naming conventions regarding my topic
Best
/M

Error:Identifiers should not contain underscores
Yasir Imran
gidyeo
FxCop design and naming rules follow the Framework Design Guidelines, a document that provides guidelines for developing class libraries that target the .NET Framework.
However, with these Design and Naming rules, FxCop will not analyze internal/private code.
What visibility is 'm_aString'
stallion_alpa
Some generated Visual Studio identifiers for applications
contain underscore characters. Underscore characters
should generally be avoided in public identifiers."
Thomas S. Andersen
Hi Mike,
In our next release we are going to be working on improving our guidance around when to use which rules and we'll also be sure to update our docs with more details. Thank you for bringing this point up. That being said if you are developing a reusable library I would not disable this rule. People sometimes under estimate the value of having a consistent naming scheme.
-Todd
Liam404
-Todd
nullptr
Target :
Word2MediaWiki__.W2MWPP_UI_Config (IntrospectionTargetType)Resolution :
"Remove the underscores from type name 'W2MWPP_UI_Config'."Target :
Word2MediaWiki__.Word2MediaWikiPlusPlus (TargetNamespace)Resolution :
"Remove the underscores from namespace name 'Word2MediaWiki__.Word2MediaWikiPlusPlus'."sryan
More specifically, FxCop complains about underscores in my Namespace and in my form, e.g. F_Form
/M
Leyan
Am I understanding you correctly, David "feel un-.NET-like" Is this the only or the most egregious problem with code that's flagged by this rule And is it really OK to feel free to turn the rule off and use underscores under such circumstances
If so, then why is this rule marked as follows:
If I take your post at face value, then the "When to suppress warnings" notation is clearly in need of update, and I would urge your team very strongly to add some of this kind of perspective/context to the documentation around a rule like this. As it stands in FxCop/Code Analysis, rules like this seem very cut-and-dried, with little room for interpretation, and it seems that this is not in the best interests of the .NET community.
Thank you in advance for considering this request/feedback.
Cheers, Mike
ClaudiaHelpOnVSTO
Yes you are interpreting the guidence correctly. Two points I'd like to meantion.
-Todd
DotNetFireball