Skip to content
David Arno edited this page Feb 17, 2020 · 8 revisions

Pattern Matching

Succinc<T> pattern matching guide


Introduction

As of C# 8, the language itself now has excellent support for pattern matching. As such, the various types Succinc<T> have been updated to support property-based matching.

Support for Succinc<T>'s pattern matching features (excluding collection matching for now as C# 8 doesn't offer an equivalent) will likely be removed in a future version, but for now they continue to be provided for developers who've not yet switched to C# 8.

One significant difference between Succinc<T>'s pattern matching and C#'s switch expression is what happens when a case isn't covered. C# will give you a compiler warning. Succinc<T> can't do this and so instead will throw a NoMatchException if no match is made when evaluated at runtime.

Topics

This pattern matching guide is split into the following sections: