Pattern Matching in C# (.Net Core)

preview_player
Показать описание
What we are going to cover in this video:
1. What is pattern matching
2. Pattern Matching in C# 7 with example
3. Pattern Matching in C# 8 with example

We are using pattern matching in C# since the very beginning of C# through a combination of If/Else and Switch/Case statements. Pattern Matching is when we check an object's member variable or property to have a full or partial match to a sequence. But these forms of pattern matching is very limited.

Functional programming languages like F#, on the other hand, are advanced supporting pattern matching since the inception of the language. We can do a lot more complex matches on an object rather than just a simple value comparison.

From C# 7 onwards, complex pattern matching is introduced in Switch/Case statements. Due to which, lot more opportunities to write easy to understand comparison code.

In this video, I tried to cover all the possible cases of pattern matching in C# as of version 8.0. As you can see using these features can significantly simplify a lot of our code. Instead of using complex if/else and switch/case statements, we can use advance concise pattern match expressions to solve a lot of problems.
Комментарии
Автор

Thanks for this video. Very informative

flygonfiasco
Автор

You should zoom a little bit more.
So that anyone can take its benefits on mobile phones too.

manjeetnandal
Автор

and there is still people saying java is better, hold my beer.

jorgefigueroa