Fundamentals of Computer Programming with C# HTML version

Chapter 1. Introduction to Programming 83
will be difficult. In our example, the class is named HelloCSharp, and as a
result we must save its source code in a file called HelloCSharp.cs.
The C# Language and the .NET Platform
The first version of C# was developed by Microsoft between 1999 and 2002
and was officially released to the public in 2002 as a part of the .NET
platform. The .NET platform aims to make software development for
Windows easier by providing a new quality approach to programming, based
on the concepts of the "virtual machine" and "managed code". At that time
the Java language and platform reaped an enormous success in all fields of
software development; C# and .NET were Microsoft’s natural response to the
Java technology.
The C# Language
C# is a modern, general-purpose, object-oriented, high-level prog-
ramming language. Its syntax is similar to that of C and C++ but many
features of those languages are not supported in C# in order to simplify the
language, which makes programming easier.
The C# programs consist of one or several files with a .cs extension, which
contain definitions of classes and other types. These files are compiled by the
C# compiler (csc) to executable code and as a result assemblies are created,
which are files with the same name but with a different extension (.exe or
.dll). For example, if we compile HelloCSharp.cs, we will get a file with the
name HelloCSharp.exe (some additional files will be created as well, but we
will not discuss them at the moment).
We can run the compiled code like any other program on our computer (by
double clicking it). If we try to execute the compiled C# code (for example
HelloCSharp.exe) on a computer that does not have the .NET Framework,
we will receive an error message.
C# uses the following keywords to build its programming constructs (the list
is taken from MSDN in March 2013 and may not be complete):
abstract as base bool break byte
case catch char checked class const
continue decimal default delegate do double
else enum event explicit extern false
finally fixed float for
foreach goto
implicit in
interface internal
lock long namespace new