Skip to content

Instantly share code, notes, and snippets.

@jackmott
Created March 23, 2017 13:51
Show Gist options
  • Select an option

  • Save jackmott/7247544a3a3312743b04c9566324e200 to your computer and use it in GitHub Desktop.

Select an option

Save jackmott/7247544a3a3312743b04c9566324e200 to your computer and use it in GitHub Desktop.
c# 7 pattern matching
switch (SomeClass)
{
case DerivedClassA a:
a.dostuff();
break;
case DerivedClassB b:
b.dostuff();
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment