| ▲ | jzebedee 5 hours ago | |||||||||||||
C# is strongly-typed, not stringly-typed. The point of the union is to list possible outcomes as defined through their respective types. The idiomatic way to do this would be to parse, don't validate [1] each string into a relevant type with a record or record struct. If you just wanted to return two results of the same type, you'd wrap them in a named tuple or a record that represented the actual meaning. [1] https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va... | ||||||||||||||
| ▲ | nesarkvechnep 5 hours ago | parent [-] | |||||||||||||
I guess C# is more strongly-typed than Haskell then... /s | ||||||||||||||
| ||||||||||||||