Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics (Retired) Prepare and Plan Program Structure

which methods come first after Main()?

so the static Main() method is executed first but how does c# decide which methods are executed next after that?

4 Answers

andren
andren
28,558 Points

C# itself never executes any method besides Main automatically, once it executes Main you (the coder) is the one responsible for calling other methods explicitly. If you don't call any methods within Main then C# will just exit the program once it reaches the end of the Main method.

ah ok, thanks for that

the method you invoke first in method will invoke first

Steven Xu
Steven Xu
3,493 Points

No requirement for which method will come next. But you need to make sure that all methods you call in Main() will list in no particular order down below.