Chapter 1. C# 3.0 and .NET 3.5

The goal of C# 3.0 is to provide a simple, safe, modern, object-oriented, Internet-centric, high-performance language for .NET development. C# is now a fully mature language, and it draws on the lessons learned over the past three decades. In much the same way that you can see in young children the features and personalities of their parents and grandparents, you can easily see in C# the influence of Java, C++, Visual Basic (VB), and other languages, but you can also see the lessons learned since C# was first introduced.

The focus of this book is C# 3.0 and its use as a tool for programming on the .NET platform, specifically and especially with Visual Studio .NET 2008.

Tip

Many of the programs in this book are written as console applications (rather than as Windows or web applications) to facilitate concentrating on features of the language instead of being distracted by the details of the user interface.

This chapter introduces both the C# language and the .NET platform, including the .NET 3.5 Framework.

The Evolution of C#

Each generation of C# has brought significant additions to the language, with a few standout features. Perhaps the most significant feature added to C# 2.0 was Generics (allowing for an enhancement to type safety when dealing with collections). If so, the most significant addition to C# 3.0 must be the addition of the Language-Integrated Query (LINQ) extensions, which add general-purpose data query extensions to C#; though that is by no means the only enhancement to C#.

Other new features include:

  • Lambda expressions (anonymous delegates on steroids)

  • Extension methods

  • Object initializers

  • Anonymous types

  • Implicitly typed local variables

  • Implicitly typed arrays

  • Expression trees

  • Automatic properties (a small gem)

Get Programming C# 3.0, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.