Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
aar0nsa3nz
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
aar0nsa3nz
7y ago
Sorry, I couldn't figure out how to write a code block.
2.
▲
by
aar0nsa3nz
7y ago
With C# 8 you can also write it as: public static double ComputeArea(object shape) => shape switch { Square s => s.Side * s.Side, Circle c => c.Radius * c.Radius * Math.PI, Rectangle r => r.Height *