CA1822
The .NET analyzer rule that suggests marking a method static when it uses no instance data.
In more detail
It fires on instance methods that never read or write any instance member. It is a readability and small performance hint, so the course leaves it as a suggestion.
Related terms
- static class — A class that cannot be instantiated and holds only static members, which belong to the type itself rather than to any object.
- Roslyn analyzer — A plug-in to the C# compiler that inspects code while you edit and build, and reports diagnostics about likely bugs, unsafe patterns or style.
Taught in
- Code Quality: .editorconfig and Roslyn Analyzers — Modern .NET Core, C# & Enterprise Microservices