Created
September 18, 2020 16:34
-
-
Save Beej126/73c20ab4e4720bd3808d5530792635ff to your computer and use it in GitHub Desktop.
csharp type pattern matching
This file contains hidden or 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
| //https://stackoverflow.com/questions/43080505/c-sharp-7-0-switch-on-system-type/46692500#46692500 | |
| switch (object.GetType()) | |
| { | |
| case Type _ when typ == typeof(SqlExpression<>): | |
| Console.WriteLine("yes!"); | |
| break; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment