Where does the .NET C# program start its flow when you build and run a console application?

Experience Level: Junior
Tags: C#

Answer

When a user starts a .NET console application, the class Program is located. Within this class the method Main is located an the code execution flow starts from there, statement by statement, line by line.

When the application below gets executed, the first command to be executed will be Console.WriteLine("Hello");.

Example
using System;

namespace MyApp {
  class Program {
    static void Main() {
      Console.WriteLine("Hello");
      Console.WriteLine("World");
    }
  }
}
Related C# job interview questions
C# for beginners
C# for beginners

Are you learning C#? Try our test we designed to help you progress faster.

Test yourself