public enum ErrorLevel { None, Low, High, }
public static class ErrorLevelExtensions { public static string ToLocalizedString(this ErrorLevel me) { switch (me) { case ErrorLevel.None: return "Everything is OK"; case ErrorLevel.Low: return "SNAFU, if you know what I mean."; case ErrorLevel.High: return "Reaching TARFU levels"; } return ""; } }
1: Console.WriteLine(ErrorLevel.Low.ToLocalizedStrings())
This uses Extensions Methods
Aucun commentaire:
Enregistrer un commentaire