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

Complete Authentication System in ASP.NET Core using JWT

JWT (JSON Web Token) authentication is widely used for securing APIs in modern applications. In this article, we will build a complete authe...