Visual Environment
- Start
application “Microsoft Visual Studio .NET 2003”
- In the
“start page” of Microsoft Visual Studio .NET, choose new project
- In
“New Project” window, under “Project Types” choose “Visual C# Projects”,
under “Templates”
- choose
“Console Application” – to develop command line programs
- or
choose “Windows Application” – to develop GUI components by drag and drop
For 1st
simple C# program, we will choose Console Application
- Now,
under “Name”, call it “FirstProgram”, under location
- You
can choose default location given
- Or
choose desktop or folder of your choice.
- At
this point the following class appears as in Figure 1.

Figure
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.
- 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
- 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
- Now,
to compile the program,
- Select
the “Build” menu item from the top menu
- And
select “Build Solution” from the drop down.
At the bottom of the window, the
message “Build succeeded” should appear, informing of successful compilation.
- Now,
to run the program,
- Select
“Debug” menu item from the top menu
- And
select “Start Without Debugging” from the drop down.
At this point, a new window should
appear as in Figure 5.

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