-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Performance.AvoidUnusedPrivateFieldsRule(git)
Sebastien Pouliot edited this page Mar 2, 2011
·
1 revision
Assembly: Gendarme.Rules.Performance
Version: git
This rule checks all private fields inside each type to see if some of them are not being used. This could be a leftover from debugging or testing code or a more serious typo where a wrong field is being used. In any case this makes the type bigger than it needs to be which can affect performance when a large number of instances exist.
Bad example:
public class Bad {
int level;
bool b;
public void Indent ()
{
level++;
#if DEBUG
if (b) Console.WriteLine (level);
#endif
}
}
Good example:
public class Good {
int level;
#if DEBUG
bool b;
#endif
public void Indent ()
{
level++;
#if DEBUG
if (b) Console.WriteLine (level);
#endif
}
}
You can browse the latest source code of this rule on github.com
Note that this page was autogenerated (3/17/2011 1:55:44 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!