SwitchLabelSyntax

Topics: APIs
Aug 20, 2014 at 4:08 AM
Is the switch label syntax missing the expression or am I overlooking something ?
With the latest update there is only the keyword & colon token.
(It used to have a 'Value' property that contained the label - but that has gone recently)
Coordinator
Aug 20, 2014 at 8:33 PM
Hey Omnibrain,

We made a change to the syntax API here recently to allow us more extensibility options in the future. Specifically, in C# today there are two forms of switch label:

case [Expression]:
default:

The previous API shape had a single node representing both forms at once with the expression being omitted in the default case.

What we now have is an abstract SwitchLabelSyntax type with concrete derived types for CaseSwitchLabelSyntax and DefaultSwitchLabelSyntax. We can extend this later with MatchSwitchLabelSyntax if we add pattern matching capabilities to the switch construct.

Does that help?

Anthony D. Green, Program Manager, Visual Basic & C# Languages Team
Aug 21, 2014 at 5:06 AM
Yes that helps - thanks.