3 ms·
Pattern matching is nice syntactic sugar for tablesque conditionals. Table driven decisions without the table. As in truth tables, where the conditions are enc
by specialist 10y ago
Pattern matching is nice syntactic sugar for tablesque conditionals. Table driven decisions without the table.
As in truth tables, where the conditions are encoded in cascading if / then if / ... blocks vs captured in a precomputed 2D array.
I forget what we call that style of programming. It's mentioned in Code Complete. Though it's not a common idiom.
- platz 10y agoThe real benefit of pattern matching is when the compiler helps you handles the different cases and warns you about one's you've missed—which isn't provided by C# 7.0's version.