String Enumeration

public interface IStringEnumeration 
{
   String.ToString();
}
public abstract class StringEnumeration<T> : IStringEnumeration
                                     where T : StringEnumeration<T>
{
   private string myString;

   public StringEnumeration(string sStringConstant)
   {
      myString = sStringConstant;
   }
   public override string ToString()
   {
      return myString;
   }
}

public sealed class MyEnumerations : StringEnumeration<MyEnumeration> 
{
   public static readonly MyEnumerations MyString1 = new MyEnumerations("MyString1");
   public static readonly MyEnumerations MyString2 = new MyEnumerations("MyString2");

   private MyEnumerations(string sEnumeration)
        : base (sEnumeration)
   {
   }
}


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext