#9 – Main() Should Not Be Public
June 26, 2010 4 Comments
The following code will compile, but is not recommended, according to the MSDN documentation. If Main() is public, other classes could call it. But this violates the intent for Main(), which is meant to only be called once, when the program is invoked.
class Program { static public void Main() { Console.WriteLine("This would compile.."); } }