How to Create Your First Program:

Below are step by step instructions for creating your first program using Microsoft Visual Studio. By the end of this tutorial, you will have a console program that will display the message "Hello World" when run.

Step 1: Open up Microsoft Visual Studio (if you have it installed, you can often find it under the Windows Start Menu.)

Step 2: Your first time using Visual Studio, you will be prompted to select a language to program in. Make sure you select Visual C#, otherwise none of the instructions you find on this website will work. Your first time running the program it will take a while to load while it saves all of its configuration data on your computer.

Step 3: In the startup page for Visual Studio, click "New Project" to start working on your new program.



Step 4: When prompted to choose the type of program you want to create, choose "Console Program" and name it "Hello World."



Step 5: Welcome to your new program. The page you now see before you is the page that will be used to make all the changes to your code. Try typing the following code into your program, and run it to see what it does. Remember to copy everything - even the punctuation marks - and please note that the C# programming language is case-sensitive.



If you copied the text correctly, the following screen should pop up when you start the program. If not, you most likely didn't copy everything down correctly. Check that you put two capitals in ReadLine, and try again.

Analysis of Program

The C# programming language runs on what are called "classes" and "methods." When you just copied that code into your program, you unknowingly were using these components with each line written. But exactly what did these couple of lines of code mean, you may wonder? Here is a brief explanation.

Console.WriteLine: In this line of code, you are telling the computer that you are using the "Console" class to perform the method "Writeline". This means you are telling it to use its console (the black screen that came up when you hit start) to literally write a line of text.

("Hello World"); This line of code is telling the computer what it should output when it performs the Console.WriteLine task. This line is what tells it to say Hello World. Important to notice is the semicolon (;) put at the end of the line. In a C# program, every line of code ends with a semicolon - that's what tells the computer that the line just ended.

Console.ReadLine(); This is another essential line of code. This code tells the program to wait for you to hit a key before continuing - which is very important because after this line all the program has left to do is end. In order to understand how important this is, just try deleting this line of code, then run the program again. Most likely, your program would just flash open and then close again instantly.