How pattern matching works for basic numeric types #8402
Unanswered
zms9110750
asked this question in
Q&A
Replies: 2 comments 5 replies
-
You're matching values, not types, and C# has built-in numeric type coercion. 1 and 1.0 are the same value as far as C# is concerned. |
Beta Was this translation helpful? Give feedback.
5 replies
-
Pattern matching is typed. They are effectively Patterns are interpreted under the type of left hand side value. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Pattern matching checks the type. But in pattern matching, different types of numerical types can be mixed.
How should I understand this issue?
by the way.Both of these are true.but 1st generate CA1508 [false]
Beta Was this translation helpful? Give feedback.
All reactions