Can the declarations inside those discriminated unions theoretically be inline functions? I know in your example you're providing the arguments and doing a little logic in the switch, i'm wondering if you could also do that kind of thing in the constructor. Maybe it wouldn't be helpful though. Cool article!
Possibly. I couldn't find as many examples of working with Discriminated Unions in the feature proposal thread. I went with the switch expressions to try to get the syntax looking as close as F#'s Match expressions as possible while still working with existing C# syntax.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Can the declarations inside those discriminated unions theoretically be inline functions? I know in your example you're providing the arguments and doing a little logic in the switch, i'm wondering if you could also do that kind of thing in the constructor. Maybe it wouldn't be helpful though. Cool article!
Possibly. I couldn't find as many examples of working with Discriminated Unions in the feature proposal thread. I went with the switch expressions to try to get the syntax looking as close as F#'s Match expressions as possible while still working with existing C# syntax.