// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; public class S8 { public enum OTT { ONE, TWO, THREE } public static void Test(OTT v) { string res = v switch { OTT.ONE => "1", OTT.TWO => "2", OTT.THREE => "3", _ => "Ooops" }; Console.WriteLine(res); } public static void Main(string[] args) { Test(OTT.TWO); Test((OTT)77); } }