Visual Environment

 

  1. Start application “Microsoft Visual Studio .NET 2003”

 

  1. In the “start page” of Microsoft Visual Studio .NET, choose new project

 

  1. In “New Project” window, under “Project Types” choose “Visual C# Projects”, under “Templates”
    1. choose “Console Application” – to develop command line programs
    2. or choose “Windows Application” – to develop GUI components by drag and drop

For 1st simple C# program, we will choose Console Application

 

  1. Now, under “Name”, call it “FirstProgram”, under location
    1. You can choose default location given
    2. Or choose desktop or folder of your choice.

 

  1. At this point the following class appears as in Figure 1.

Figure 1

 

  1. The .NET environment adds some code pertaining to namespace, which is not necessary for the 1st and simple program. Therefore, let’s modify it so that you are aware of the essentials of a basic C# program. See Figure 2.
    1. Later you can rename the class name, to anything you which, by right clicking on “Class1.cs”, in the “Solution Explorer” frame and clicking on “rename”. When you do this you must also delete “Class1” in the code view to whatever you called the class. See Figure 3.

Figure 2

 

Figure 3

 

  1. Now add the following code in the “Main” method

Console.WriteLine(“This is my first C# program!”);

      At this point, the class should look like as it does in Figure 4.

Figure 4

 

  1. Now, to compile the program,
    1. Select the “Build” menu item from the top menu
    2. And select “Build Solution” from the drop down.

At the bottom of the window, the message “Build succeeded” should appear, informing of successful compilation.

 

  1. Now, to  run the program,
    1. Select “Debug” menu item from the top menu
    2. And select “Start Without Debugging” from the drop down.

At this point, a new window should appear as in Figure 5.

Figure 5

 

  1. You can go back add other code, recompile and rerun the program to see the changes you have made.