Obtaining Visual Studios C# Express
You will first need to download and install C# express from the microsoft website. Also make sure that you have the microsoft .net framework 3.5 installed (if you have recently ran Windows Update, then you are likely to have this installed already).
Once installed, run Microsoft Visual Studios.
Go to File->New Project
You will want to pick “Console Application” for your first program. In another tutorial, we will delve into Windows Form Applications!
Choose the file path and file name for you application. The source code will save to that folder along with several other files, including a ‘.sln‘ file. The ‘.sln’ file can be used to open the project in Visual Studios if you close it.
Click ‘Ok’ and a screen with your Program class and Main function will be generated.
Within the Main function, add the following code:
Console.WriteLine(“\nPress Enter to Continue…”);
The WriteLine function writes the text within quotes followed by a return character(goes to new line).The Write function writes the text within quotes without a return character at the end.
The last two lines stop the Console from exiting automatically.
Your code window should look like the following:
Now let’s run the program!
Go to Degub->Start Debugging
The Console window should popup with some familiar text written on it!
That was easy enough!!
Now that you know how to create and run a simple Console application, lets learn about the types of variables in c# and how to declare and use them in c#.