Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Object-Oriented Programming with C#

You're reading from   Hands-On Object-Oriented Programming with C# Build maintainable software with reusable code using C#

Arrow left icon
Product type Paperback
Published in Feb 2019
Publisher Packt
ISBN-13 9781788296229
Length 288 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Abhishek Sur Abhishek Sur
Author Profile Icon Abhishek Sur
Abhishek Sur
Raihan Taher Raihan Taher
Author Profile Icon Raihan Taher
Raihan Taher
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Overview of C# as a Language FREE CHAPTER 2. Hello OOP - Classes and Objects 3. Implementation of OOP in C# 4. Object Collaboration 5. Exception Handling 6. Events and Delegates 7. Generics in C# 8. Modeling and Designing Software 9. Visual Studio and Associated Tools 10. Exploring ADO.NET with Examples 11. New Features in C# 8 12. Understanding Design Patterns and Principles 13. Git - The Version Control System 14. Prepare Yourself - Interviews and the Future 15. Other Books You May Enjoy

Evolution of C#

C# has been one of the most dynamic languages in recent times. This language is open source and mostly driven by a group of software engineers, who recently came up with lots of major changes to enhance the language and provide features to handle the complexities in the languages that exist. Some of the major enhancements that have been put forward for the language include Generics, LINQ, Dynamics, and the async/await pattern:

In the preceding diagram, we can see how the language has evolved from its inception with managed code in C# 1.0, to async programming constructs that were introduced in C# 5.0, to modern-day C# 8. Before going further, let's look at some of the highlights of C# in its different stages of evolution.

Managed code

The phrase managed code came into being after Microsoft declared the .NET framework. Any code running in a managed environment is handled by Common Language Runtime (CLR), which keeps

Generics

Generics is a concept that was introduced with C# 2.0 and allows template type definition and type parameters. Generics allow the programmer to define types with open-ended type parameters that dramatically changed the way that programmers write code. The type-safety with dynamic typed generic templates improves readability, reusability, and code performance.

LINQ

The third installment of the C# language introduced Language Integrated Query (LINQ), a new construct of queries that can be run over object structures. LINQ is very new to the programming world and gives us a glimpse of functional programming on top of object-oriented general programming structure. LINQ also introduced a bunch of new interfaces in the form of the IQueryable interface, which introduced a number of libraries that can interact with the external world using LINQ. LINQ was boosted with the introduction of Lambda expressions and expression trees.

Dynamics

The fourth instalment also provides a completely new construct. It introduces the dynamic language structure. The dynamic programming capability helps the developer to defer the programming calls to runtime. There is a specific syntactic sugar that was introduced in the language that compiles the dynamic code on the same runtime. The version also puts forward a number of new interfaces and classes that enhance its language capabilities.

Async/await

With any language, threading or asynchronous programming is a pain. When dealing with asynchrony, the programmers have to come across many complexities that reduce the readability and maintainability of the code. With the async/await feature in the C# language, programming in an asynchronous way is as simple as synchronous programming. The programming has been simplified, with all of the complexities handled by the compiler and the framework internally.

Compiler as a service

Microsoft has been working on how some parts of the source code of the compiler can be opened up to the world. Consequently, as a programmer, you are capable of querying the compiler on some of its internal work principles. C# 6.0 introduced a number of libraries that enable the developer to get an insight into the compiler, the binder, the syntax tree of the program, and so on. Although the features were developed for a long time as the Roslyn project, Microsoft have finally released it to the external world.

Exception filters

C# 6.0 is adorned with a lot of smaller features. Some of the features give the developers an opportunity to implement complex logic with simple code, while some of them enhance the overall capabilities of the language. Exception filters are newly introduced with this version and give a program the capability to filter out certain exception types. The exception filters, being a CLR construct, have been hidden in the language throughout its lifetime, but were finally introduced with C# 6.0.

C# 8 and beyond

With C# being the most dynamic language in the market, it is constantly improving. With the newer features, such as nullable reference types, async streams, ranges and indices, interface members, and many other features that came with the latest version of C#, they have enhanced the basic features and helped programmers to take advantage of these new constructs, hence making their lives easier.

Note that, during the language's evolution, the .NET framework was also made open source. You can find the source code of the .NET framework at the following link: https://referencesource.microsoft.com/.

You have been reading a chapter from
Hands-On Object-Oriented Programming with C#
Published in: Feb 2019
Publisher: Packt
ISBN-13: 9781788296229
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime