Rule Definition
Unused private types or members are dead code that should be removed. Removing dead code helps with maintainability and readability of the code.
This rule will not raise violation for:
* Empty constructors
* Attributed members
* Main method
Remediation
Remove unused private or internal types or members.
Violation Code Sample
public class Klass
{
private void PrivateMethod() {...} // VIOLATION
private class PrivateClass {...} // VIOLATION
}
Fixed Code Sample
public class Klass
{
public Klass()
{
PrivateMethod();
}
private void PrivateMethod()
{
var c = new PrivateClass ();
}
private class PrivateClass {...}
}
Related Technologies
Technical Criterion
Dead code (static)
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.