c# switch expression pattern matching

switch expression Evaluate a pattern m…. At the preceding example, a switch expression uses the following patterns: A constant pattern: to handle the defined values of the Direction enumeration. A discard pattern: to handle any integer value that doesn't have the corresponding member of the Direction enumeration (for example, (Direction)10). That makes the switch expression exhaustive.

switch expression Evaluate a pattern m…
switch expression Evaluate a pattern m… from i2.wp.com

Web  In this blog post, let’s look at C# 9.0 pattern matching in switch expressions. In the previous blog post you learned about using patterns with the is pattern expression, and you learned about the new relational patterns in C# 9.0, and also about the new pattern.

0 komentar