ReSharper 2017.2 Help

Code Inspection: Class is never instantiated (non-private accessibility)

This is a solution-wide code inspection. It only works when the solution-wide analysis is enabled.

ReSharper determines if no objects of a class were created in a project — in fact, if no direct instances or usages of the class were found. If the class only contains static members (and/or constant fields), ReSharper suggests making the class static. In other cases ReSharper suggests making the class abstract, if possible.

Note that due to the fact that ReSharper only detects direct instantiation or usage, it will issue this warning even in cases when the class is, in fact, being used, but is instantiated indirectly — for example, via reflection or a dependency injection container. In such cases, you can either suppress this inspection locally or disable it altogether.

Last modified: 11 December 2017

See Also