Today at work I we did a code review as we do now and again, but today I saw a syntax I haven't seen before. I have searched the web for it to no avail, and what is even more interesting is that, despite using the same version of Visual Studio, that is, 2017 Enterprise, I get a syntax error at home when I try to recreate what I saw at work today. It looked something like this:
switch (someObject) {
case TypeOne valueOne: action1(); break;
case TypeTwo valueTwo: action2(); break;
// ... and so on
}
In other words, it looked like they checked both type and value in one go. But like I said, I can't find it on the internet and I get a syntax error at home. I know there's a lot of new stuff in C# 7, especially in terms of syntactic sugar. Can you explain this?