创建新的ASP.NET Core 3项目后,在Visual Studio 2019中收到以下警告:
Warning CA1052 Type 'Program' is a static holder type but is neither static nor NotInheritable
public class Program
{
public static void Main(string[] args)
{
// ...
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
// ...
}
Run Code Online (Sandbox Code Playgroud)
vs
public static class Program
{
public static void Main(string[] args)
{
// ...
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
// ...
}
Run Code Online (Sandbox Code Playgroud)
Should I add the static modifier? Why / Why not? Pro's and Cons'?
Edit: …