Created
January 29, 2019 17:01
-
-
Save richlander/ddd9bfbcc26256376ed8bb1e2a9929b2 to your computer and use it in GitHub Desktop.
C# 8 Switch Expression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static string Display(object o) => o switch | |
{ | |
Point { X: 0, Y: 0 } => "origin", | |
Point { X: var x, Y: var y } => $"({x}, {y})", | |
_ => "unknown" | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment