Switch Expression in C# 8

Introduction

C# 8 introduce switch expression, an elegant and compact new way to write switch statements.

It's important to note that the switch expression is not a replacement to the classic switch statement but it can be used in the majority of the situations. What you can do with the switch expression can always be done with a switch statement but not the opposite. 

In this video, you will learn how you can convert a classic switch statement to the new syntax and the limitations of this new feature.

Practical Video

Conclusion

Honestly I think the switch expression is the best feature added to the C# 8 language. It's a feature that can greatly impact you code bases by making them easier to read. My recommendation is to always use switch expressions unless you hit a limitation and you are forced to rely on the old classic switch statement.

Keep Learning...

Top 10 C# Developer News from Microsoft Build 2020
The Microsoft Build 2020 conference this year is completely free. Watch the live event on the official Build 2020 website.[...]
Agile Estimation
Designed by ijeab / Freepik I'd like to share with you some of my notes after taking the course on Agile[...]
Nullable Reference Types in C# 8
Introduction C# 8 introduce switch expression, an elegant and compact new way to write switch statements. It's important to note[...]
Switch Expression in C# 8
Introduction C# 8 introduce switch expression, an elegant and compact new way to write switch statements. It's important to note[...]
How Delegates Work in C#
Most developers new to C# don't fully understand how delegates work and it's a frequently asked question in the Productive[...]
Notes from ProgNET London 2019
In the past three days I attended the ProgNET London 2019 conference.Here my key notes from the various sessions and[...]
Sharing is Caring
  • prafulla says:

    unable to see the video

  • >