Home / Forums / Pattern Matching Mastery in C# 11 & 12: List Patterns & Property Patterns [Discussion #8]

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Tutorial

Pattern Matching Mastery in C# 11 & 12: List Patterns & Property Patterns [Discussion #8]

SimdSamurai
AVX-512 & SSE
MEMBER
Rep: 285
Join Date: Aug 2021
Posts: 7
Thanks: 36
4y ago · Aug 22, 2021 4:39 PM
#1
C# 11 introduced list patterns and slice patterns! Here is how you can parse command arguments or byte sequences elegantly with pattern matching.
SimdSamurai · AVX-512 & SSE
Vectorizing matrix multiplications and particle engines with...
The following users thanked SimdSamurai for this post:
StructAligner
Data-Oriented Design
VIP
Rep: 301
Join Date: Dec 2025
Posts: 8
Thanks: 25
4y ago · Aug 22, 2021 8:45 PM
#2
List patterns like if (args is ["move", var x, var y]) make parsing input commands read like plain English instead of index checking!
StructAligner · Data-Oriented Design
Structure of Arrays (SoA) vs Array of Structures (AoS) for m...
RenderLoop
Graphics Pipeline Dev
MEMBER
Rep: 348
Join Date: Jul 2020
Posts: 6
Thanks: 94
4y ago · Aug 23, 2021 11:45 PM
#3
Combined with switch expressions and relational patterns (e.g. >= 0 and <= 100), pattern matching makes complex state machines super concise.
RenderLoop · Graphics Pipeline Dev
Double buffering, triple buffering, vertical sync, and frame...