So my first C# tutorial has to be Hello World and is taken from the Microsoft Visual C# Hello World tutorial. This is a visual C# console application which i named “Hello” although you probably didn’t need to know what i named the program.
In the application // these two slashes stand for comments and are ignored by the complier.
Our C# program must include a main method which in mine is void but can also be int but you must return 0 to show the main has executed correctly. In the () of the main is an argument that is a string array, this is necessary for the console application, so pretty much you have to have it in their.
We use “using system” so we can use anything from the System classes without having to write “System.Console.WriteLine” we can just write “Console.WriteLine” instead. System is an input output stream much like the iostream in C++.
The Hello World program code is listed below in italics :
//Libaries needed to be used
//A C# console application must include a main
//In this program it is void so nothing needs to be returned
static void Main(string args)
//This line will print to the console screen Hello World
Console.WriteLine(“Hello World !”);
//This will print to the console screen telling the user to press any key
Console.WriteLine(“Press any key to exit.”);
//This line will gain the key input from the user