What C# Programmers Need to Know About Pattern Matching
summary
C# 7 pattern matching cuts common boilerplate by combining selection, assignment and evaluation into one construct: it replaces is/as casts and nested ifs with type pattern cases, adds guard expressions for extra checks, and introduces the discard operator to ignore matched values. Examples include simplifying WPF control-reset code, rewriting FizzBuzz using tuples, and a Roslyn-based search tool that finds EF Core sites where null checks vanish; unit tests still pass and performance impact remains to be measured.
AI-written summary · about
chapters (5)
- 0:00Start
- 2:33What is Pattern Matching?
- 18:35Real Examples
- 32:37Other Languages
- 48:47When should you use pattern matching?
related talks
26mThe Road to Pattern Matching in Python
42mMatch Case for Beginners
26mStructural Pattern Matching in Python
22mModern C#: A Dive into the Community's Most Loved New Features
10mAn Exploration of Python's Upcoming Match Statement
11mI learned everything about the match statement so you don't have to
16mDynamic Pattern Matching with Python
40mLet’s catch up with C#! Exciting new features in C# 9, 10, 11, 12 and 13!
