Access modifiers like public
, private
are not allowed on static constructors in C#. Yet, Visual Studio code analysis has a warning in C# security category that says "CA2121: Static constructors should be private".
Is it possible to make a static constructor non-private? Or is that an error of Visual Studio code analysis?
CLARIFICATION: I'm not trying to make any constructor non-private. So "why?" questions are irrelevant. I'm just curious about the contradiction between two Microsoft tools and want to see if there is anything I don't know about how static constructors are handled.