Total .NET Analyzer Rule Documentation  

UnusedCode Rule

The statement has no effect on the application's functionality.

Remarks

Code is considered "unused" if it has no effect on the outcome or functionality of the application. Unused code consists of any code that does not meet the following criteria:

1. Write a value to memory (such as parameters passed by reference and reference types)
2. Return a value (such as function return values)
3. Change the code's meaning (such as declaration statements)
4. Call a function.
5. Does not define a variable that is used by any statement that meets 1 - 4 above.

Having unused code in your application can use excess system resources, detrimentally affect performance, and make code difficult to understand and maintain.

Resolution

To optimize performance and code readability, consider removing code that does not affect the application's functionality.

See Also