

So, we can safely eliminate unused public members in this program. With this program, the only projects using public classes are other projects inside the same solution. This could be true if you’re publishing them as an API through a web service or releasing your code as a library. This is because the code analyzer assumes public members might be used by other programs. Unfortunately, you can only detect unused private members. This is where you define the code issues you want to know about. In Visual Studio, you can create a custom “ruleset”. Here are two ways to find unused classes, properties, and functions. Common things that are missed are properties in XAML and parameterless constructors used for deserialization. Sometimes, they say something isn’t used when it actually is used. NOTE: The code analysis tools below aren’t perfect. If you don’t do this, you may spend time doing other refactoring on things that aren’t used – which is a waste of time. The next step I want to do is remove any unused classes, properties, and functions.
