// 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 S7 { public enum OTT { ONE, TWO, THREE } public static void Test(OTT v) { string res; switch(v) { case OTT.ONE: res = "1"; break; case OTT.TWO: res = "2"; break; case OTT.THREE: res = "3"; break; default: res = "Ooops"; break; } Console.WriteLine(res); } public static void Main(string[] args) { Test(OTT.TWO); Test((OTT)77); } }