Chapter 23. C#

Microsoft's answer to Java (the language, not the run-time environment) is C# (pronounced "see sharp"). Among the languages of the C family, it stands between Java and C++. C# definitely owes a lot to Java. It is probably easier to migrate from Java to C# than from any other programming language (including C++ and Visual Basic). In many areas C# goes beyond Java by resolving some of its problems (such as the rift between primitive values and objects) and preserving more of C++ features.

Microsoft unveiled C# as part of the .NET framework in July 2000. At the same time, Microsoft submitted the C# specification together with the most fundamental parts of the .NET framework (in particular the common language infrastructure, CLI) to the European Computer Manufacturers Association, ECMA, where it was adopted as an ECMA standard by end of 2002.

23.1. Software and Installation

I've used two environments to run the C# programs: Microsoft's .NET SDK version 1.1 and Mono, Ximian's open source implementation of the .NET framework, version 0.23. In fact, I switched from one to the other without problems when moving the book to the Linux platform. Both compilers are available for free and are easy to install using a Windows installer or a Linux package (Debian package in my case). Microsoft's C# compiler is called csc and the Mono C# compiler is mcs. To run the test programs, just enter the code with your favorite text editor, apply the compiler with the file containing the C# code (e.g., csc hello.cs and start the created executable (e.g., hello.exe). There is an emacs modefor C#.

References

[RICHTER02]> is a well-written introduction to .NET and the framework class library using C# as the programming language. The book gives a lot of background material, e.g., on the garbage collection algorithm used in the CLR.

[LIBERTY02]> concentrates more on C# as a language and adds more examples including database access with ADO.NET and user interface programming with web forms (ASP.NET) and windows forms.

Jeffrey Richter, 0-7356-1422-9, Microsoft Press, 2002, Applied Microsoft .NET Framework Programming.

Jesse Liberty, 0-596-00309-9, O'Reilly, 2002, Programming C#: Second edition.