Re:C# Pattern Matching
by DaiPlusPlus on Tuesday February 04, 2020 @07:27PM
(#22242743)
I use OneOf<T...> in C# a lot now. If you’re thinking of the same one I am the only ugly thing about it is the code-generation required to generate all of the variations from OneOf<T0,T1> to OneOf<T0,T1,T2,T3,T4,T5,T6>.
However, only direct experience will make you reconsider.
I’ve seen a discriminated union implementation in C# the other day and was repulsed.