15 reasons why you should learn C# in 2022

Andrea MVP on why  you should learn C#

Why you should learn C#?

This is the question I want to answer in this article.

I am Andrea, a Microsoft MVP, senior C# developer and .NET community lead. I have more than 12 years of professional experience using C# and in this article, I want to share my top 15 reasons why I consider C# the best programming language in the world and why you should learn C# in 2022. 

1. C# is simple, readable and easy to use

As a developer, like it or not, you spend most of your time reading and understanding code rather than writing it.

This is why, one of the most important quality I consider in a programming language is readability.

The effort language designers put in creating constructs and new syntax to make the code readable, elegant and compact is extremely valuable for optimising modern team-based software development.

A language should not get in the way of readability but, on the contrary, it should provides ways to express your intent clearly.

C# was designed from the ground up with simplicity and readability in mind.

C# was inspired by languages like C, C++ and Java but the designers took the best parts of them and innovated further by introducing new concepts like value types, properties and events. For example, C# does not allows to use raw pointers directly to memory and it does not offer multiple class inheritance. C# provides a garbage collector that is handling the memory on your behalf. For the majority of scenarios, you don’t need to worry about memory management and that is just an example of what makes working with C# a lot easier.

The C# language is also easy to learn because by learning a small subset of the language you can immediately start to write useful code. More advanced features can be learnt as you become more proficient, but you are not forced to learn them to get up and running. 

C# is very good at encapsulating complexity. Sometimes, you can successfully use C# features even without fully understanding how they work under the covers. You can work with iterators for years without ever understanding how they work. You can work with async and await without knowledge of all the intricacies about how the feature is implemented by the compiler. This is the important OO encapsulation principle applied to the language itself. I find this to be remarkable about C#.

2. C# is all about developer productivity

Developer productivity is another key design principle for C# since the first release.

C# is a strongly typed language developed to make it easy to build powerful tools on top of it.

Visual Studio and Visual Studio Code are best in class software development environments used by C# developers. The R# Visual Studio extension provides incredible productivity, code analysis, code-generation features to 10X your developer experience. Rider is a new powerful and popular cross-platform IDE for C# software development.

As a developer, I really care about productivity. I love to work with tools that help me to be more effective in my job. I like that I can rely on the powerful C# compiler to find errors even before I run my code. With C# 9 you can even get the compiler to help creating null-safe software.

C# also contains a tons of features, explicitly introduced to the language to improve productivity and make common tasks easy to do:

  • The null-conditional operator enable developers to do null-checking in an incredibly succinct way.
  • Indexes and Ranges allows to intuitively create slices from collections
  • Var reduce the need to duplicate type names
  • Generics avoid duplicating code that only varies by type while preserving type-safety
  • Records and top-level statements help to remove a lot boilerplate code and be more productive
  • Global and Implicit using help to save horizontal and vertical screen space

3. C# is a multi-paradigm programming language

C# started as a strongly object-oriented language and over time become a multi-paradigms language supporting imperative, declarative, generic and functional programming styles.

Generics introduced in C# 2 enabled developers to implement algorithms and data structures that were parametric with types. They key thing was that this feature was implemented natively in the runtime, making generics completely efficient and type safe.

LINQ introduced functional programming to C#. The combinations of features like lambda expressions, anonymous types, extension methods, expression trees introduced a functional and uniform way to query data sources.

LINQ is one of the most elegant and powerful technology inside C#. The query syntax also provides a declarative, SQL like experience directly inside the programming language.

LINQ introduced an unmatched readability to our C# code, transforming the way C# software was developed in the wild.

C# 7, 8, 9 and 10 continued the functional journey adding capabilities like switch expressions and advanced pattern matching to the language.

4. C# is a flexible general-purpose language

C# is very flexible and allows you to develop a big variety of systems.

With C# you maximize the return of investment on your skills because you can build almost any kind of applications:

  • Console applications
  • Desktop applications (Windows Forms, WPF)
  • Windows Services
  • Web Services and Web applications (ASP.NET Core, Blazor)
  • Native Mobile Applications (.NET MAUI)
  • AI Applications (ML.NET)
  • Distributed and Cloud Applications (Azure)
  • Games (Unity)
  • IoT applications
  • Reusable libraries

It's important to say C# was not design to develop system-level performance critical software. It was not designed to compete directly on performance and size with the C and C++ languages.

5. C# runs on a solid well-engineered .NET runtime

C# was not designed in isolation but as part of the overall .NET framework project.

The .NET runtime (called CLR) is an outstanding piece of engineering that provides memory management, JIT compilation, assembly versioning and loading, security, thread synchronization, exception handling, common type system, attributes, interoperability with unmanaged code, culture and more.

In the recent years .NET Core was developed from the ground up and improved on the original .NET implementation in some significant ways. .NET Core provides the ability to develop cross-platform applications, new deployment modes, incredible performance and much more.

.NET and .NET Core finally converged in .NET 6 on November 2021 and set the foundation of a single modern unified platform for C# software development. Exciting times!

6. C# is cross-platform

At the beginning C# was a language exclusively reserved for Windows developers because the .NET framework was tightly coupled with the Microsoft operating system. This was certainly a limiting factor in the adoption of C#.

Finally, this is no longer the case!

.NET 6 has been designed from the ground up to run on multiple operating systems including Linux and Mac.

.NET MAUI also provides the ability to run your C# code natively on mobile platforms like Android and iOS.

You can now run your C# on multiple operating systems. This is fantastic!

7. C# is mature, popular and in very active development

C# is 21 years old.

C# is a very mature language that evolved significantly over the years.

The C# language is one of the top 5 most popular programming languages and .NET Core is the most loved software development framework in the world.

C# is in very active development. The latest stable release is C# 10 that was released in November 2021 and introduced many improvements to the language.

New major releases of C# are expected to be released every year alongside updates to the new unified .NET.

8. C# is Open-Source and led by Microsoft

C# is now fully developed in the open on Github. 

The last 4 releases (C# 7, 8, 9 and 10) were developed using an open-source model and future releases will continue to be developed in this way. 

Everyone can provide feedback and propose new features by creating issues on the official C# Github page.  

All notes from official design meetings are publicly shared with the community.

Behind the C# development language there is Microsoft, the most successful software company in the world.

Microsoft is ultimately responsible to preserve the key design principles of the language. In my opinion, this is a very good thing!

Microsoft is a different company then what used to be in the past. They truly embraced open source and recently become the largest contributor to open source software.

Microsoft is developing C# following these four key strategy guidelines:

  1. We will keep growing C# to meet the evolving needs of developers and remain a state of the art programming language.
  2. We will innovate aggressively while being very careful to stay within the spirit of the language.
  3. We will prefer language and performance improvements that benefit all or most developers.
  4. We will continue to empower the broader ecosystem and grow its role in C#'s future, while maintaining strong stewardship of design decisions to ensure continued coherence.

9. C# has an active and vibrant community

I love the C# and .NET community. 

The community is probably one of the major reasons why I decided to invest on C# for my professional career.

I started by attending local .NET events in Italy and I met some amazing developers over the years. Despite my very limited experience, one of them convinced me to create the official .NET community in Tuscany that I led for 8 years. 

In the past 7 years, I led the official .NET community in Cambridge, UK organizing events every month for 1200+ professional .NET developers. 

Developers love to meet regularly in a safe environment to learn and grow from each other. It's fun. It's rewarding. It's useful for your career to practice speaking skills and to build your network. I even found my latest job thanks to a community event.

The .NET Foundation is an independent organization to foster open development and collaboration around the .NET ecosystem. It provides support to .NET community leaders to run communities and it’s currently actively supporting 380 .NET meetup groups around the world.

In my experience local communities are the best but developers also love to meet online in addition to attending conferences.

If your level of contribution in the community is high enough, Microsoft also rewards individual with a very special award called Microsoft MVP. I am honoured to be part of such a group. We meet regularly at a special event called the Microsoft MVP summit organized in the Microsoft headquarters each year.

If you are a community person and you love to interact with passionate developers, you will certainly love entering the C# world.

10. C# is a well-documented language

The official documentation on the C# language is very well-written. It's the right place to start learning C#.

Microsoft Learn also provide learning materials on a wide variety of topics relevant for C# developers. 

If you want to master C#, learn all the latest features and stay up-to-date with the language join the Productive C# membership.

If you want a more rigorous exploration of the C# language syntax visit the official C# specification.

11. C# has built-in design patterns and best practices

C# embed directly in the language many important design patterns. It helps to implement design patterns correctly in a very elegant way.

The IEnumerable and IEnumerator interfaces, yield and the foreach keywords provide an extremely simple and intuitive way to implement the Iterator design pattern.

The using statement and the IDisposable interface provided an simple way to cleaning up resources after usage.

Events are an idiomatic implementation of the Observer design pattern (publish/subscribe).

Delegates provides an idiomatic and more functional way to implement the Strategy and Factory design patterns.

Async/Await provide an intuitive way to implement asynchronous programming while maintaining a similar level of productivity as writing synchronous code.

12. C# can leverage an extensive collection of libraries

The Base Class Library provided by the .NET framework is a massive help in the hands of C# developers.

C# can tap on a vast collection of types to implement the most common tasks like using the file system, sending and receiving data over the network, performing math and crypto operations and much more.

NuGet is the de-facto package manager for .NET and provide a 232K+ unique packages instantly available to be consumed inside your C# applications.

You really have a lot of reusable components and frameworks available at your fingertips as soon as you adopt C#.

13. C# can run very fast

It's true that C# has not been designed with performance as a key design goal.

However, over the years C# introduced many features to help developers optimize performance and memory allocations.

Structs, pointers, fixed statements, ValueTuple, ValueTask, ref structs, stackalloc initializers, Span<T>, Memory<T>, String.Create are all features and types that provide ways to improve performance in critical C# applications. .NET 6 and ASP.NET Core capitalize on those features to create a super fast runtime and web application framework.

C# can be optimized to run very fast but please don't get caught in premature optimization. Most of the time you don't need to care about speed and keeping your code readable is way more important. Also don't forget that the JIT compiler generate machine code at the exact time when the code is executed and that sometimes can generate code that is even faster than code compiled ahead of time like C and C++.

Don't let performance be a reason stopping you to learn and adopt C#.

14. C# can run in the browser

Blazor is the latest addition to the .NET technologies and probably one of the most exciting and promising.

Blazor is a framework to build client web applications with C# instead of Javascript leaveraging the standard WebAssembly technology. You can finally run C# in the browser without forcing the users to install plugins. A web assembly compiled version of a trimmed .NET runtime is used to run your C# code natively directly in any browser.

Blazor is definitely a framework you want to keep an eye on and start using in production.

15. C# developers are in high demand

C# skills are in demand and big and small organizations are using C# daily to develop their critical systems.

There is no shortage of C# developers jobs in the world and this means C# is a secure investment to your future career.

According to Payscale, an experienced C# developer can earns an average total compensation of more than $90K in US.

Salaries around the world varies but it's clear that mastering C# can help you secure a very high paid job.

Conclusion: Learn C# in 2022

I hope this article helped you to better understand the role of C# in the software development industry and why it is such a loved and productive language. C# is a well-designed language in high demand in top software companies around the world. Deciding to invest in mastering C# can be one of the best career decision you can make in 2022.

This article was one of the 50 contributions to the third annual C# advent and now updated for 2022. Thank you Matthew for the opportunity to share my love for C#.