User:Sc4Freak/Sandbox

Properties
Property rules are available in the Gendarme.Rules.Properties.dll assembly.

AvoidPublicInstanceFieldsRule
In most cases, it is usually better to have public properties, rather than public instance fields.

Bad example:

Good example:

ConsiderConvertingMethodToPropertyRule
Methods which function similarly to properties should be converted into properties. For example, member functions beginning with "Is", "Get", or "Set" are likely candidates.

Bad example:

Good example:

AvoidReturningArraysOnPropertiesRule
Returning arrays from a property can be dangerous, because the caller doesn't know whether or not it's a copy of the original.

Bad example: