Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
See more:
I had this as a job interview question.

My answer was the static int/void Main method, however, they said that was wrong and an application can be entered anywhere. Are they right? How is this possible? (ie: some type of debugging tool?)

Thanks.
Posted
Comments
Sergey Alexandrovich Kryukov 5-Apr-13 23:02pm    
Are you sure it was phrased exactly as you described? As such, it sounds gibberish. Perhaps you did not understand those people, or they didn't know what they are talking about. Anyway, I explain all which is involved in my answer, please see.
—SA

1 solution

There is no such thing as "application can be entered". If you mean the entry point of the application, it can really be ambiguous. For such cases, there is a project option helping to select a class declaring the class used to define the application entry point; the entry point function itself is defined according to this:
http://en.wikipedia.org/wiki/Main_function#C.23[^].

To see how an entry point can be selected to resolve the ambiguity in Visual Studio, please take a look a the project properties. For C# compiler (csc.exe), options please see:
http://msdn.microsoft.com/en-us/library/6ds95cz0.aspx[^].

This is how the entry point is selected: http://msdn.microsoft.com/en-us/library/x3eht538.aspx[^].

As you can see, the name of the declaring class should be used.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900