Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should RouteConfig.cs be static class

Tags:

asp.net-mvc

By Defualt, when you create a new ASP.Net MVC app, the RouteConfig is not a static class but the only method it has "RegisterRoutes" is a static method.

When I analyse my code using SonarQube, the tool suggests the following for RouteConfig.cs

Add a "protected" constructor or the "static" keyword to the class declaration

So, should I make the class static?

like image 429
Rajat Avatar asked Feb 17 '26 16:02

Rajat


1 Answers

Whether the class is static or not will not change the behavior of the application. So if it is for making your code analysis tool happy, go ahead, make it static.

like image 89
Darin Dimitrov Avatar answered Feb 19 '26 08:02

Darin Dimitrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!