3 ms·
Also, it defines them as nested classes, and marks the outer class as `sealed`, as they're closed types, and it prevents the type being extended with new cases.
by sparkie 8y ago
Also, it defines them as nested classes, and marks the outer class as `sealed`, as they're closed types, and it prevents the type being extended with new cases.
C# can't do this because the compiler rejects putting `abstract` and `sealed` on the same type.
- contravariant 8y agoYou can kind of solve this by making the constructor of the outer class private and defining all subtypes as nested types. It's not ideal, but it works.