C#
In this part of the C# tutorial, we will introduce the C# programming language.Goal
The goal of this tutorial is to get you started with the C# programming language. The tutorial covers the core of the C# language. Variables, arrays, control structures and other core features. It is not a complete coverage of the language. It is a quick, introductory material. This tutorial uses command line compilers to build applications. It does not cover graphical interface development, or visual IDEs. This tutorial focuses on the C# language; everything else is considered a distraction.C#
C# is a modern, high-level, general-purpose, object-oriented programming language. It is the principal language of the .NET framework. The design goals of the language were software robustness, durability and programmer productivity. It can be used to create console applications, GUI applications, web applications, both on PCs or embedded systems. It is a very popular language. Currently, it is one of the top 10 popular languages in the world. It was created on the Windows platform. The Mono project has created a clone for the Linux and Mac platforms. C# is a compiled language. The source code is compiled into executable (.exe) files, which are executed by the .NET platform.Programming languages
There are currently several widely used programming languages. The following list is based on the TIOBE Programming Community Index. The numbers are from August 2010. Note that these figures are only illustrative.Position | Language | Ratings |
---|---|---|
1 | Java | 18% |
2 | C | 17.9% |
3 | C++ | 9.7% |
4 | PHP | 9.2% |
5 | Visual Basic | 5.4% |
6 | C# | 5% |
7 | Python | 4.2% |
8 | Perl | 3.4% |
9 | Objective C | 3.2% |
10 | Delphi | 2.4% |
PHP dominates over the Web. While Java is used mainly by large organizations, PHP is used by smaller companies and individuals.
Visual Basic represents the popularity of rapid application development and the dominance of Microsoft.
The C# was planned to be the next big language. It should compete mainly with Java and C/C++ languages.
Python and PERL are popular scripting languages and close competitors.
The popularity of the Objective C stems from Mac and their innovative appliances.
Deplhi is a popular RAD development tool.
Compiling
There are two prominent C# compilers. The Microsoft C# compiler and the Mono C# compiler.Linux On Linux, we need to install the Mono C# compiler. It is called gmcs for C# 3.0 profile and dmcsfor the C# 4.0 profile. To install the Mono C# compiler, we must install the Mono platform.
$ gmcs simple.csWe compile and run a simple C# program on Linux.
$ ./simple.exe
This is C#
Windows On Windows, we have two basic options. Either use the command line compiler or use some version of the Visual Studio. The .NET framework is already installed on many versions of Windows OS. If not, we download it and install it from the microsoft.com website.
On my system, the .NET framework was installed on C:\WINDOWS\Microsoft.NET\Framework\v3.5. Here we find the csc.exe file, which is a compiler of the C# language.
C:\programming\csharp>C:\WINDOWS\Microsoft.NET\Framework\v3.5\csc.exe simple.csWe compile and run a simple C# program on Windows.
C:\programming\csharp>simple.exe
This is C#
Another option is to use e.g. Visual Studio C# Express Edition. We create a new project. Select File/New Project or click Ctrl+N. Select Console application.
Figure: Console application
To run an example, click Ctrl + F5.
Sources
The following sources were used to create this tutorial:- msdn.com
- wikipedia.org
- stackoverflow.com
- C# Language specification
0 comments:
Post a Comment