Tuesday, October 11, 2016

Remove Unused/Dead Code Using Visual Studio


Many developers don't know about how to remove un-used code and block.  Visual Studio giving facility to resolve this.


The following are the rules:

  • Private methods that are not called from any other code (CA1811)
  • Unused local variables (CA1804)
  • Unused private fields (CA1823)
  • Unused parameters (CA1801)
  • Internal classes that are not instantiated from any other code (CA1812).

Steps to add code analysis rule

Right click on Project solution > select Property


There you can see code analysis settings


Apply setting as per you requirement.




No comments:

Post a Comment

Opps Part 1 : Abstraction

  Abstraction in C# is a fundamental concept of object-oriented programming (OOP) that allows developers t...