using System;
// Above using System is written to use the system library provided in C#.
namespace Learn2Code{
// This is a class containing the main() function.
class program{
// This the main() function of C# program.
static public void main()
{
Console.WriteLine("Hello C#")
}
}
}
Explanation of above C# code:
using system:
using system line is used to use the library provided by the C#. It provides some important functions such as Console class and WriteLine() function or method.
Namespace :
namespace keyword is used to declare a scope within which classes or methods can be present within a single scope. It makes the code more organized.
Program class:
Program class is the main class which contains the main() function.
Main() function/method:
Main() method is called the entry point of the C# program. It is the method from where the execution of program starts. It is always static as static keyword makes memory for main() method only hence only one main method is present in C# program.