Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1.     public enum Enum1{
  2.         Yes,
  3.         No
  4.     }
  5.  
  6.     public static class EnumExtension
  7.     {
  8.         public static string Translate(this Enum1 arg)
  9.         {
  10.             switch (arg)
  11.             {
  12.                 case Enum1.Yes:
  13.                 {
  14.                     return "Tak";
  15.                 }
  16.                 case Enum1.No:
  17.                 {
  18.                     return "Nie";
  19.                 }
  20.                 default:
  21.                     throw new NotImplementedException();
  22.             }
  23.         }
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement