C#だと、次のバージョンでパターンマッチ採用されるみたいね
https://github.com/dotnet/roslyn/blob/future/docs/features/patterns.md