Shawn Wildermuth
Coding Shorts: Don't Be Afraid of Pattern Matching in C#
https://www.youtube.com/watch?v=o86RTNme3eU
- 09:09 - pattern matching can be used with ranges
var msg = value switch {
...
(>=35 $$ < 255) => "large"
...
}
- 11:03 - pattern matching range and tuple can be combined
var msg = (status, value) switch {
...
("failed", >=35 $$ < 255) => "error"
...
}
- 13:07 - example of pattern matching with named tuples and using it with a class instance
- 14:06 - pattern matching with array
Comments
Post a Comment