What is the difference between
public static void Main()
and
private static void Main()
in a C# console appli
The difference between both is the only difference in public
and private
access modifiers because both are valid.It totally depends on the usage of application which one to use.
If you want to initiate entry point by any external program, (ie use as API, for testing purpose) then you might need to make it public so it is accessible.
If you know there is no external usage for the application then it is better to make it private so no external application get access to it.