I wrote up how I'd do this in scala, just to compare and contrast val shape: Option[Shape] = ??? shape.map { case Square(0) | Circle(0) => 0 case Triangle(b, h) if b == 0 || h == 0 => 0 case Rectangle(l, h) if l == 0 || h == 0 => 0 case Square(side) => side * side case Circle(radius) => radius * radius * math.Pi case Triangle(base, height) => base * height / 2 case Rectangle(length, height) => length * height } what…
https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csh...