I have the two blocks of code that I would like to think are equal:
First the if based block
if
Then the exact same but converted to switch case over
This is a known bug when you capture (in a lambda) a pattern variable that was declared in a switch statement. See https://github.com/dotnet/roslyn/issues/16066