Main() Should Not Be Public

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.


1
2
3
4
5
6
7
class Program
{
    static public void Main()
    {
        Console.WriteLine("This would compile..");
    }
}