The Evolution of c#
Since its original 1.0 release, C# has been evolving at a rapid pace. Not long after C# 1.0, Microsoft released version 1.1. It contained many minor tweaks but added no major features. However, the situation was much different with the release of C# 2.0. C# 2.0 was a watershed event in the lifecycle of C# because it added many new features, such as generics, partial types, and anonymous methods, that fundamentally expanded the scope, power, and range of the language.
29.
Version 2.0 firmly put C# at the forefront of
computer language development. It also demonstrated Microsoft’s long-term commitment to the language.
The next major release of C# was 3.0. Because of the many new features added by C# 2.0, one might have expected the development of C# to slow a bit, just to let programmers catch up, but this was not the case. With the release of C# 3.0, Microsoft once again put C# on the cutting edge of language design, this time adding a set of innovative features that redefined the programming landscape.
30.
These include lambda expressions, languageintegrated query (LINQ), extension methods, and implicitly typed variables, among others. Although all of the new 3.0 features were important, the two that had the most high-profile
impact on the language were LINQ and lambda expressions. They added a completely new dimension to C# and further emphasized its lead in the ongoing evolution of computer languages.
31.
The current release is C# 4.0, and that is the version of C# described by this article. C# 4.0 builds on the strong foundation established by the previous three major releases, adding several new features. Perhaps the most important are named and optional arguments. Named arguments let you link an argument with a parameter by name. Optional arguments give you a way to specify a default argument for a parameter. Another important new feature is the dynamic type, which is used to declare objects that are type-checked at runtime, rather than
compile time.
32.
Covariance and contravariance support is also provided for type parameters,
which are supported by new uses of the in and out keywords. For those programmers using the Office Automation APIs (and COM in general), access has been simplified. (Office Automation and COM are outside the scope of this book). In general, the new 4.0 features further streamline coding and improve the usability of C#.
33.
There is another major feature that relates directly to C# 4.0 programming, but which is provided by the .NET Framework 4.0. This is support for parallel programming through two major new features. The first is the Task Parallel Library (TPL) and the second is Parallel LINQ (PLINQ). Both of these dramatically enhance and simplify the process of creating programs that use concurrency. Both also make it easier to create multithreaded code that automatically scales to utilize the number of processors available in the computer.
34.
Put directly, multicore computers are becoming commonplace, and the ability to parallelize your code to take advantage of them is an increasingly important part of nearly every C# programmer’s job description.
35.
How C# Relates to the .NET Framework
Although C# is a computer language that can be studied on its own, it has a special
relationship to its runtime environment, the .NET Framework. The reason for this is twofold. First, C# was initially designed by Microsoft to create code for the .NET Framework. Second, the libraries used by C# are the ones defined by the .NET Framework. Thus, even though it is theoretically possible to separate C# the language from the .NET environment, the two are closely linked. Because of this, it is important to have a general understanding of the .NET Framework and why it is important to C#.
36.
What Is the .NET Framework?
The .NET Framework defines an environment that supports the development and execution of highly distributed, component-based applications. It enables differing computer languages to work together and provides for security, program portability, and a common programming model for the Windows platform. As it relates to C#, the .NET Framework defines two very important entities. The first is the Common Language Runtime (CLR).
37.
This is the system that manages the execution of your program. Along with other benefits, the Common Language Runtime is the part of the .NET Framework that enables programs to be portable, supports mixed-language programming, and provides for secure execution. The second entity is the .NET class library. This library gives your program access to the runtime environment. For example, if you want to perform I/O, such as displaying something on the screen, you will use the .NET class library to do it.
38.
If you are new to programming, then the term class may be new. Although it is explained in detail later in this article, for now a brief definition will suffice: a class is an object-oriented construct that helps organize programs. As long as your program restricts itself to the features defined by the .NET class
library, your programs can run anywhere that the .NET runtime system is supported. Since C# automatically uses the .NET Framework class library, C# programs are automatically portable to all .NET environments.
39.
