Thursday, March 11, 2010

Writing First C# Program:

C# (pronounced as "C Sharp") is a new programming language from Microsoft and it is heralded to revolutionize the computing industry, especially in the area of software development. You see, the problem with the software industry is that it is not mature enough compared to other industries such as construction or automotive. This results to lack of proven processes, tools and techniques to enable a programmer to develop consistent, high quality programs.

However, as the software industry matures we constantly look for new ways to improve the delivery and robustness of our software solutions based on our past mistakes. A programming language that can eliminate software bugs is yet to be discovered. C# is Microsoft's attempt at it. In this article, we shall investigate what constitutes a basic C# program and how it is structured.

Let's begin by writing a C# program that displays the standard greeting message.



If you've programmed in C or C++, you'll notice the similarities immediately. Actually, if you ask me, the code looks a lot closer to a Java program than C/C++.

A house is similar to a computer program in that both have a front door. The front door of a program is where the operating system to starts to execute your program, in other words, it is the entry point into your program. In our C# example, you'll notice that a function call is defined. This is the entry point of our program. Like C/C++, C# is also a case specific programming language. That means that when you write your programs, you have to be aware that and are different.

You will also notice that the function is enclosed within a class structure called . This is a change in mindset for most C/C++ programers. Because in C#, every function in a C# program must be a member of a class. In the following articles, you'll see the benefit of defining your application as a class and its implications on how your program is represented in the .Net world. The single line in the code simply calls a standard class function,

The copyright of the article Writing Your First C# Program in c programming is owned by Jose Aniceto. Permission to republish Writing Your First C# Program in print or online must be granted by the author in writing.

Like any programming language, you can write a C# program using any editor and store it as a text file. There are obviously benefits in using a proper development environment, especially if you want to develop commercial products. For now, all you have to do now is start Notepad, type in the program example and store the program with as .

After going through a basic C# program, your next challenge is to try and compile the program. Next week we will discuss the finer details of establishing a C# development environment.


No comments:

Post a Comment