1

Possible Duplicate:
dynamic enum in C#

I don't know if this is theoretically possible.

I want to create a custom control, but one of the properties editable via the Visual Studio designer (an enumeration) is dynamic.

The purpose being I have different projects that, via a seperate editor I've written, export a project-specific enumeration, and would like to create a widget that supports different projects dynamically.

I.E.

class Widget : Panel
{
    //**********This bit to be dynamic*****************
    private EnumThatIdLikeToBeDynamic dynamicEnum = 0;

    public EnumThatIdLikeToBeDynamic DynamicEnum
    {
        get { return dynamicEnum ; }
        set { dynamicEnum = value; }
    }
    //*************************************************

    public ItemWidget()
    {
    }

    //Etc
}

My only solution I can see at the moment is to export the widget on a per-project basis from the tool that exports the enumeration.

Is there any way to achieve this with only a single widget?

P.s. it HAS to be an enumeration. Using an integer type and casting outside of the widget is not acceptable.

Community
  • 1
  • 1
Toby Wilson
  • 1,467
  • 5
  • 19
  • 42
  • Possible duplicate of Checkout some Stackoverflow postings here - http://stackoverflow.com/questions/725043/dynamic-enum-in-c-sharp http://stackoverflow.com/questions/857414/dynamically-create-an-enum – MethodMan Oct 10 '12 at 15:29

0 Answers0