In this post you will learn all the basic essentials to begin C# programming. In the end you will know what Visual Studio.NET 2010 is and be able to write a simple program. This is not difficult if I can learn this stuff I am more then sure you can. So lets get it!!!
Click For registration and to attend our free seminar here in Atlanta.
System Requirements:
- Windows 2000 operating system or greater
- Visual Studio. NET 2010 - for this purpose we will use the Free 2010 C# Express Edition
Download Visual Studio C# Express Edition by clicking here Please be sure to completely install this software before continuing.
Visual Studio.NET 2010
Visual Studio allows you to develop c# applications easily. It is the platform which allows you to actually write your code, debug your code, compile and execute any program that you write. You can use Visual Studio to quickly build web applications, console applications, windows applications, mobile applications and web services. If you plan to work in any real world environment as a c# .NET Developer it is imperative that you have a great understanding of how this application works.
Creating Your First Application
After downloading and installing Visual Studio 2010 C# Express edition run the application and you should see the screen below:

To create the type of application we will study in this lesson, on the main menu, you can click File -> New Project or you can simply click New Project located in the section below the title. Next, In the Templates section of the New Project dialog box, you can click Console Application, accept the default name or change it and click ok as seen below.

After clicking OK, skeleton code would be created for you. Lets dive right in a figure out what is exactly is going on see the c# code below that was auto generated by Visual Studio.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
}
}
}
First here is a list of keyword definitions used in the skeleton code that you must understand I try to break these down into simple terms.
Key Definitions
namespace - gives you the ability to organize your code within a scope. It also allows your code to become unique globally when used within your application or when your code is used outside this application. 2 types user defined which is what we are implementing notice the code "namespace Console Application1" or system defined in which Microsoft itself has developed. Full list found here Microsoft .NET Framework
using - in this content its the "using directive". This gives you the ability to reference and utilize other code or libraries organized as namespaces outside your current namespace. It could be a user defined namespace or system defined namespaces as I pointed out above.
class - a specification or blueprint of how to construct something (think of it as a set of instructions) . It defines the data and behavior of a type. We will dig into more examples in further lessons as this is a core concept of Object Oriented Programming.
method - a subroutine of a class. They define the behavior of a class. In auto generated code above we have the method "Main" in which Every C# application must contain a single Main method specifying where program execution is to begin.
Now that we have a better understanding of what the keywords mean in the generated code lets move forward. The System, System.Collections.Generic, System.Linq and System.Text system defined namespaces are referenced as defaults as they contain common classes that we more then likely would use in our program.
As pointed out above the main method is what gets executed first so we will start to write our first line of code here inside this method for our fist simple program but before that I want to point out a couple areas within Visual Studio that you need to know about and understand to build our simple program successfully.
Maneuvering around Visual Studio 2010
If we look to the far right pane of visual studio we will find the Solution Explorer as seen in the image below:

The solution explorer provides you with an organized view of all files associated with your project.
Note: Once you create any type of program in Visual Studio a project is automatically created to hold your files which is then bundled into a solution which can hold multiple projects.
In this case the project is named ConsoleApplication1 which you notice highlighted and bold the Solution also has the same name.
Notice the References tree node if you expand it you will notice references to other libraries which have namespaces that contain classes so that if we wanted we could reference them in our program with the "using" keyword.
Notice the "program.cs" file. This is the file that contains the auto generated code we just reviewed. This is the file that actually contains our core code. We could create many .cs files but we will get into this Object Oriented Concept later in future lessons.
Now, if we look to the top of Visual Studio in the main menu if you click Debug -> Build Solution this will command visual studio to compile or review our code, assemble it and determine if it is ready for execution. If it detects any errors if will be sure to let you know.

If you click Debug -> Start Debugging this will command visual studio to attempt to run or execute our program but it will compile first and if there are errors it will be sure to let us know.
Creating Our Hello World Program!
Now that we know a little bit more about how to compile and run our program lets write some code and create our first application. Inside our Main method we are simply going to write the following code as you see below:

The Console Class has a method called WriteLine. The WriteLine method accepts a string parameter "Hello World". The behavior is to write "Hello World" to the console. We will get into what exactly are parameters and strings in future lessons.
I have also called Console's Class ReadLine method. This method defines the behavior that will have the Console wait until we hit Enter before the Console kills itself and the program terminates. This gives us a chance to see the output of the first method WriteLine.
If you write that code and from main menu click Debug -> Start Debugging to run the program you should get the following output:

If you see the Hello World output hit "Enter" on your keyboard and watch the program terminate. You have successfully created your first application.
If you are interested in learning more about computer programming with c# please do not hesitate to contact us.
Click For registration and to attend our free seminar here in Atlanta.
The market demand for application developers are at a all time high and we are here to get you ready to take advantage of the opportunity!