Re:A Preview of C# 8 [video]
by khaledh on Saturday August 26, 2017 @12:29AM
(#15104073)
I know this doesn't solve your problem in C#, but F# gives you a compiler warning in such a case. The following code compiles without warnings or errors:
However, if you add Yellow as a new case to the Color discriminated union without adding a corresponding match pattern everywhere you match a Color value, you get a compiler warning:
Aside: notice how terse and readable the code is compared to the C# equivalent; F# tends to have a high signal-to-noise ratio.
[ Parent
| on HN ]
There are no comments on this comment yet.