Skip to content

Instantly share code, notes, and snippets.

@Beej126
Created September 18, 2020 16:34
Show Gist options
  • Select an option

  • Save Beej126/73c20ab4e4720bd3808d5530792635ff to your computer and use it in GitHub Desktop.

Select an option

Save Beej126/73c20ab4e4720bd3808d5530792635ff to your computer and use it in GitHub Desktop.
csharp type pattern matching
//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