This book describes the programming language C# (pronounced “c sharp”), version 2.0. It is a quick reference for the reader who has already learnt or is learning C# from a standard textbook and who wants to know the language in more detail. It should be particularly useful for readers who know the Java programming language and who want to learn C#.
C# is a class-based single-inheritance object-oriented programming language designed for the Common Language Runtime of Microsoft’s .Net platform, a managed execution environment with a typesafe intermediate language and automatic memory management. Thus C# is similar to the Java programming language in many respects, but it is different in almost all details. In general, C# favors programmer convenience over language simplicity. It was designed by Anders Hejlsberg, Scott Wiltamuth and Peter Golde from Microsoft Corporation.
C# includes many useful features not found in Java: struct types, operator overloading, reference parameters, rectangular multi-dimensional arrays, user-definable conversions, properties and indexers (stylized methods) and delegates (methods as values), but omits Java’s inner classes. See section 29 for a summary of the main differences.
C# may appear similar to C++, but its type safety is much better and its machine model is very different because of managed execution. In particular, there is no need to write destructors and finalizers, nor to aggressively copy objects or keep track of object ownership.
This book presents C# version 2.0 as used in Microsoft Visual Studio 2005, including generics, iterators, anonymous methods and partial type declarations, but excluding most of Microsoft’s .Net Framework class libraries except threads, input-output, and generic collection classes. The book does not cover unsafe code, destructors, finalization, reflection, pre-processing directives (#define, #if, . . . ) or details of IEEE754 floating-point numbers.