Searching for a better implementation to EnumBase In a former question on SO I described a problem with a construct called 'EnumBase'.

As I sad there, I am not involved when basic implementation happened. So I'm not sure why the thinks are a they are. I only know that the code was written in times of .Net 2 and 3.5. The derived classes are useed as DataSources in ASP.Net and WinForm GUIs and also for Switch-Statements. 

Here the shorted main code of a typical derivates class:

public class Elements : EnumBase&lt;int, Elements&gt;
{
    public static readonly Elements Element1 = Create("Number 0", 0);
    public static readonly Elements Element2 = Create("Number 1", 1);

    // This empty constuctor is the solution of the previous question
    static Elements() {}


    private static Elements Create(string text, int value) 
    {
        return new Elements() { text = text, value = value };
    }

    public static String GetElement(int id)
    {
        return BaseItemList.Single(v =&gt; v.Value == id).Text; 
    }
}


And the EnumBase inself (the parameter dosentMatter in the empty constructor is no joke):

[Serializable()]
public class EnumBase&lt;T, E&gt; :  IEqualityComparer&lt;E&gt; 
        where E : EnumBase&lt;T, E&gt;
{
    private static readonly List&lt;E&gt; list = new List&lt;E&gt;();
    protected string text;
    protected T value;

    protected static IList&lt;E&gt; BaseItemList
    {
        get
        {
            return list.Distinct(new EnumBase&lt;T, E&gt;(false)).ToList();
        }
    }

    protected EnumBase()
    {
        list.Add(this as E);
    }

    /// &lt;summary&gt;
    /// Constructor for distinct to avoid empty elements in the list
    /// &lt;/summary&gt;   
    private EnumBase(bool dosentMatter) {}

    public string Text
    {
        get { return text; }
    }

    public T Value
    {
        get { return value; }
    }


    #region IEqualityComparer&lt;E&gt; Member

    // ...

    #endregion
}


The switch statemaents are also not really nice (i'm not a friend of long switch an if-else-constructs, but bring polymorphism in the code is still a very very long way):

Switch
  Case Elements.Element1.value
  ...
  Case Elements.Element2.value
  ...


As you see, you have to use .value every time, which is a nice source for bugs if you forgot it :-/

All in all living with EnumBase leaves every time a strange feeling. There is a lot of code which is to write in every derived class again and again. And a lot of things can go wrong if you create or use an EnumBase derived-class. One the other hand it works but this can be 'the' argument.

From my point of view it would be nice if I can use more types form .Net-Framework instead of own programmed types. So the Question is, is there maybe something new in .net 4.0 (or even exists in .Net before 4.0) which make this implementation (in parts) obsolete?

I would be grateful for any hint.
So, extending my comment... 

Enums are designed to represent a fixed number of states. This is their purpose. If that is what you need then nothing prevents you from using standart enum. If you want to specify items source as a collection of enum values - use IEnumerable&lt;MyStandartEnum&gt;, for example:

//collection of all enum values
var allVlues = Enum.GetValues(typeof(MyStandartEnum)).Cast&lt;MyStandartEnum&gt;();
//collection of elements which satisfy SomeCondition() (extension method)
var someValues = Enum.GetValues(typeof(MyStandartEnum)).Cast&lt;MyStandartEnum&gt;().Where(x =&gt; x.SomeCondition());


If you need some complicated logic added to enum, if you need to extend it, etc., that only means that enum is not the right abstraction in your case. Instead of trying to emulate enum's behaviour in some wierd abstract class, you should build a proper class to represent your data and then use generic collections (or implement your own).