Understanding C# Programming Language

First of all, let’s once again welcome you to the world of this new programming language. We hope you will have a basic idea about Object Oriented Programming languages because many languages like Java, C++ have come by the past five years.

However, there will be no difficulty in learning this language if you are a fresher, because this session and the coming ones will explain all the concepts and features right from the beginning. Wherever required, I explained the features involved in C-Sharp by comparing them with Java. This will ensure smooth progress for experienced programmers.  Let’s discuss the basic requirements needed to begin C# programming.

Requirements

To begin programming with C#, you should require the following:

Windows 2000, XP, Vista Operating System
.NET Framework Software Development Kit (SDK) 
Code Editors like NotePad, Visual Studio

Optional requirements

Visual Studio .NET
Third party editors

A detailed explanation regarding the above requirements are outlined below

Windows 2000 Operating System

As a first step, you should require this Operating System installed on your system. This Operating System comes in two flavors, viz., Professional and Server editions. However, Professional edition is the best choice among many users. Even though, Windows 98 is suitable for C# programming, it’s not possible to work any .NET based server-side programming on it. Hence, Windows 98 is not the best choice for C# programming.

.NET Framework Software Development Kit (SDK)

This Kit is required for compiling and executing C# and other .NET programming languages and it uses built-in command line compiler (csc.exe) and interpreter for the same. It can be downloaded as a 110 MB file from the Microsoft’s Website. The SDK comes with various tools for building, deploying applications, sample codes and the required documentations. It also comes with all the necessary tools to build and deploy ASP.NET applications. The topic of code editors as outlined in the requirement number 3 will be discussed later in this article. To know more this kit, refer to the section “Related Links” at the end of this article.

Visual Studio .NET

You can also develop C# applications using Visual C# .NET, available with Visual Studio .NET. But this is an optional choice and it’s up to you to decide whether to use it or not. This will help you to develop windows based applications easily and with limited effort because you don’t have to devote too much time in designing the user interface with WinForms. The only work left for you to do is to write the coding appropriately as per the .NET Standards. A forthcoming session on this article will explain about third party editors in detail. To know more details about Visual Studio .NET refer to the section Related Links at the end of this article.

READ  Learn how to work with Java Servlets

Installation of .NET Framework SDK 

After downloading the SDK, locate the drive and folder where you have downloaded the file. Click on the file to begin installation. The following figures will show you the process of installation. When you click on the file, you will see a dialog box as shown in Figure 1. Click Yes to proceed further.

 

The setup will begin extracting the required cab files as shown in Figure 2

Sometimes, while extracting the setup will ask you to update the Windows installation. If you had done this before then it will not ask for the same. If not, click yes to have the setup update your current installation. Windows will prompt you to restart the system. Click Yes to do so.

After doing the above process, the setup will show a series of dialog boxes to proceed with the Installation. After displaying the initial screen, setup will show a license agreement box. Click on the I Agree radio button to move on to the folder selection box. You can either choose an existing folder or can specify a new folder name.

We recommend you to specify a new folder name. Setup will automatically create the folder for you. After this, you may have to select the options for Installation. The whole process is self-explanatory and may vary depending up on the versions. Finally, setup begins the Installation and it will also show you the balance time left to complete the Installation.

When the .NET Framework has been completely installed, you have to again restart your system. After that, you can start programming with C#. You should have to install optional components like Microsoft Data Access Components 2.7 for developing ASP.NET applications. The last session of this chapter illustrates how to code a simple “Hello World” C# program.

READ  Understanding Structures and Enumeration using C#

About the Editors

Choosing an editor for coding the source code is a tedious task ahead of every programmer. There will be various types of editors brought out by different companies. They are elaborated below in detail.

Notepad

Notepad is the best and widely used editor among developers using .NET SDK. It comes with the every edition of Windows Operating System and it’s easy to use. Also, it does not require much investment.

However, it is not the most suitable editor since it does not support syntax coloring and highlighting, compilation and execution directly from the editor, code numberings etc. But as you know, Notepad in Windows 2000 Professional would support the famous Ctrl+G shortcut for finding line numbers.

Visual C++ 6.0

Developers can use Visual C++ 6.0 included with Visual Studio 6.0. However, they should make some tweaking in the registry before using the same. It supports syntax colorings and other features such as finding line numbers (Ctrl+G). However, it is dangerous for a new user to make changes in registry. Hence, only advanced and experienced users can be able to use Visual Studio 6.0 for developing C#. It’s not possible to compile and execute the applications from the Visual C++ 6.0 environment. Hence, there is not much use except some of the one or two features listed above.

Visual Studio .NET

Visual Studio .NET provides all the integrated tools and wizards for creating C# and
other .NET based language applications. It also supports features such as Intellisense, Dynamic help etc. Moreover, you can compile and execute your applications from the IDE itself. Hence, in order to experience the power of developing the .NET applications, you should try out Visual Studio .NET. But be prepared to pay a huge sum for this wonderful stuff.

Third – Party Editors

Many Third Party editors are now available and can be downloaded from the Internet. One such editor is called Antechninus C# Editor. It supports color-coding, compilation and Execution from the IDE, Project maintenance and accessing .NET Framework documentation using its help menu and etc. It can be downloaded free of cost from http://www.c-point.com/download/csharped.zip. Moreover, the editor comes with built-in tutorials on C# and can be accessed from the Help menu.

READ  A Comparison between Java & C#

However, it is up to you to decide upon which editor to use. I recommend you to try one common editor and learn the language in full.  

The “Hello C#” Program

Majority of developers use to learn programming by coding “Hello World” program. But for a change we will see “Hello C#” program. As mentioned in the previous session, you can use any editor to code the program. It’s up to your convenience as to which editor to use. Listing 1 shows the coding for our “Hello C#” program:

— Listing 1 —

using System;
class Hello
{
public static void Main()
{
Console.WriteLine("Hello C#");
}
}

After entering the above code in an editor, you have to perform the following steps

  1. Save the file as Hello.cs. cs is an extension to indicate C-Sharp 
    like .java for a Java source file. You have to supply this extension while saving your file, otherwise the code will not compile correctly. The saved file will be of the extension .cs.txt.
  1. Compile the code by giving the following command at the command prompt:

csc Hello.cs

  1. If there are compile errors you will be prompted accordingly. Otherwise, you will be viewing a command prompt along with the copyright information as shown in Figure 4.
  2. As a final step, you have to execute the program in order to view the final output. For that purpose, you have to simply give a command as shown below at the command prompt. See Figure 4. If everything goes on well, then you can be able to view the message “Hello C#” as shown in the figure above.

Leave a Reply

Your email address will not be published.