I have a question about the startup code in C#.Net 2008. I have not looked at C#.net code in several years and now I have a c#.sln project that I need to work with.
I am trying to find where the code actually starts. I found the startup project folder.
These project contains lots of C# modules. Can you tell me how I can tell where the code actually starts in the startup project? Would I look for a main.cs file?
Should I just step through the code to see where the application actually starts? If so, what should I do to make certain this code will not actually run the production application?

2 answers
It depends what type of application it is.
If it's a console or windows forms application, then Visual Studio will generate a file called program.cs which contains the Main() method.
However, if it's an ASP.NET or WPF application, you won't be able to find a Main() method because this is generated in the background when the HTML or XAML is combined with the 'code behind'.
Also, there will be no Main() method for a class library application because there's no entry point for such an application.
answered one year ago by:
17279
If it's a console or windows forms application, you could find this by loading the solution in Visual Studio and hitting F10 or F11. This will "step into" the first line of code to be executed. This can be handy if the entry point for the application isn't where you would expect for some reason.
answered one year ago by:
2499
17279
Good tip, foamy :)
412
I'd once seen a popup window named "Watch" it appears with F12, It's something like inserting Break and checking the code..... Are u people aware of something that that????
17279
Yeah, the 'Watch window' is a debugging tool which allows you to watch the value of a variable or expression change as the program executes. It won't help jassie though who's trying to find out where the program starts.