C# – Evolution

Although it’s already over 15 years since the original release of C#, the language doesn’t feel that old. One reason being it has been updated on a regular basis.

C# 1.0

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

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.
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.

C# 3.0

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. 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.

C# 4.0

With the release of C# 4.0, and that is the version of C# described by this book. 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.

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#. 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.

C# 5.0

Microsoft released C# 5.0 in 2012 and introduced a very important new language feature: async/await syntax for asynchronous calls.

It made asynchronous programming much more accessible to everyone. The feature was accompanied by an extensive set of new asynchronous methods for input and output operations in .NET framework 4.5, which was released at the same time.I also can’t use the using statement anymore to close the stream because without the await keyword to pause the execution of the method, the stream could be closed before the asynchronous reading was complete.
And even this code is using the ReadToEndAsync method added to the .NET framework when C# 5.0 was released. Before that, only a synchronous version of the method was available. To release the calling thread for its duration, it had to be wrapped into a Task.

C# 6.0

C# 6.0 was released in 2015. It coincided with the full rewrite of the compiler, codenamed Roslyn. An important part of this release was the compiler services which have since then become widely used in Visual Studio and other editors:
Visual Studio 2015 and 2017 are using it for syntax highlighting, code navigation, refactoring and other code editing features.

Many other editors, such as Visual Studio Code, Sublime Text, Emacs and others provide similar functionalities with the help of OmniSharp, a standalone set of tooling for C# designed to be integrated in code editors.
Many third-party static code analyzers use the language services as their basis. These can be used inside Visual Studio, but also in the build process.

  • Dictionary initializer can be used to set the initial value for a dictionary.
  • The nameof operator returns the name of a symbol.
  • Null conditional operator reduces the ceremony around checking for null values.
  • Static import allows direct invoking of static methods.
  • String interpolation simplified string formatting.
Versions
0 0 vote
Article Rating

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x