Name | Checked | Synopsis |
---|
7@101
|
 |
Declare all fields (data members) private |
7@102
|
 |
Prevent instantiation of a class if it contains only static members |
7@105
|
 |
Explicitly define a protected constructor on an abstract base class |
7@106
|
 |
Make all types internal by default |
7@107
|
 |
Limit the contents of a source code file to one type |
7@108
|
|
Use using statements instead of fully qualified type names |
7@201
|
|
Selection statements (if-else and switch ) should be used when the control flow depends on an object's value; dynamic binding should be used when the control flow depends on the object's type |
7@301
|
|
All variants of an overloaded method shall be used for the same purpose and have similar behavior |
7@303
|
 |
If you must provide the ability to override a method, make only the most complete overload virtual and define the other operations in terms of it |
7@304
|
 |
Only use optional arguments to replace overloads |
7@401
|
|
Specify methods using preconditions, postconditions, exceptions; specify classes using invariants |
7@402
|
|
Use code to describe preconditions, postconditions, exceptions, and class invariants |
7@403
|
|
It shall be possible to use a reference to an object of a derived class wherever a reference to that object's base class object is used |
7@404
|
 |
Don't hide inherited members with the new keyword |
7@501
|
 |
Do not overload any 'modifying' operators on a class type |
7@502
|
 |
Do not modify the value of any of the operands in the implementation of an overloaded operator |
7@503
|
|
If you implement one of operator==() , the Equals method or GetHashCode() , implement all three |
7@504
|
|
Use a struct when value semantics are desired |
7@520
|
 |
Override the GetHashCode method whenever you override the Equals method. |
7@521
|
 |
Override the Equals method whenever you implement the == operator, and make them do the same thing |
7@522
|
 |
Override the Equals method any time you implement the IComparable Interface |
7@523
|
 |
Do not throw exceptions from the Equals or GetHashCode methods or the equality operator (== ) |
7@525
|
 |
Override the Equals method on value types. |
7@526
|
 |
Reference types should NOT override the equality operators ('== ' and '!= ') |
7@530
|
 |
Implement operator overloading for the equality (== ), not equal (!= ), less than (< ), and greater than (> ) operators when you implement IComparable |
7@531
|
 |
Overload the equality operator (== ), when you overload the addition (+ ) operator and/or subtraction (- ) operator |
7@532
|
 |
Implement all relational operators (< , <= , > , >= ) if you implement any |
7@533
|
 |
Do NOT use the Equals method to compare diffferent value types, but use the equality operators instead. |
7@601
|
|
Allow properties to be set in any order |
7@602
|
|
Use a property rather than a method when the member is a logical data member |
7@603
|
 |
Use a method rather than a property when this is more appropriate |
7@604
|
|
Do not create a constructor that does not yield a fully initialized object |
7@608
|
 |
Use pattern matching instead of the "as" keyword |
7@609
|
 |
Use the correct way of casting |
7@610
|
 |
Use explicit interface implementation only to prevent name-clashing or to support optional interfaces |
7@611
|
 |
Use generic constraints if applicable |
7@700
|
|
Do not ignore method results |