
Functional C# with Simon Painter
.NET Rocks!
00:00
The Discriminated Union of C-Sharp
The discriminated union is a way to represent an operation that might have worked or might not have worked in C-sharp. Think of it as being like shredding as type. So imagine creating an abstract class, and we'll call it maybe, and give it absolutely no properties whatsoever. It's just literally a blank class. And then you inherit off that twice. The first time call it something, and that's actually got a value inside; the other one doesn't have any properties either. But the point is that you're forcing the real type to be one or the other.
Transcript
Play full episode