C# – Understanding First Program

In this lesson, we will write our first C# program. We will also understand what a C# program syntax looks like with its purpose. Before beginning with the example, let us see what a C# syntax includes:

  • using System: We will write this as the first line of the program. This includes the System namespace using the using keyword in C#.
  • Namespace: The namespace is basically a collection of classes. In our example, the namespace demo is having the class A namespace can have multiple classes.
  • Class: Next, comes the class declaration. A class is a blueprint and consists of one or more methods. Our program is only having a single method Main().
  • Main(): The first line in our class is the Main() since it is considered as the entry point of any C# program.
  • WriteLine: Inside the Main() method, we have mentioned the Console class with a method WriteLine() to print a line. It will display the text inside it on the screen.

Let us see an example that we discussed above to understand to create and run our first C# Program:


C# Tutorial
C# User Input
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment