标签:
For example:
The code uses one of the basic C# types, but does not use the built-in alias for the type.
Rather than using the type name or the fully-qualified type name, the built-in aliases for these types should always be used: bool, byte, char, decimal, double, short, int, long, object, sbyte, float, string, ushort, uint, ulong.
so String.Empty is wrong (depend on above rules) and string.Empty is good.
I do not agree :)
<Rule Name="UseBuiltInTypeAlias">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
2. How to exclude private members from StyleCop rule SA1600
I am not very interesting with write documents for private members :)
<AnalyzerSettings>
<BooleanProperty Name="IncludeFields">False</BooleanProperty>
</AnalyzerSettings>
3. A field name in C# must not begins with an underscore.
I do not agree :)
<Rule Name="FieldNamesMustNotBeginWithUnderscore">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
4. By default, StyleCop does not allow variable or field names to include Hungarian notation
How can I allow nh (NHibernate)
<Analyzers>
<Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.NamingRules">
<AnalyzerSettings>
<CollectionProperty Name="Hungarian">
<Value>nh</Value>
</CollectionProperty>
</AnalyzerSettings>
</Analyzer>
</Analyzers>
5. More rules you can found in the below url:
http://www.stylecop.com/docs/StyleCop%20Rules.html
标签:
原文地址:http://www.cnblogs.com/zhangpengc/p/4940060.html