1058 shaares
75 liens privés
75 liens privés
2 résultats
taggé
switch
Learn about the patterns supported by the is and switch expressions. Combine multiple patterns using the and, or, and not operators.
var currentlight = getcurrentlight();
string action = currentlight switch
{
TrafficLight.red => "stop",
TrafficLight.orange => "slow down",
TrafficLight.green => "go",
_ => "unknown",
}