tags:

views:

40

answers:

2

This is my Enum

public enum MyEnum {Blue, Red};

There is another external enum called ExternalEnum, I don't have and couldn't change its source code but I can use the class, say I know there are yellow and white in it.

What I want to do is to pull all the elements in the external enum, make them part of my enum, i.e.

public enum MyEnum {Blue, Red, ExternalEnum.Yellow, ExternalEnum.White};

Is there a way I can do this easily so each time I get a new version of ExternalEnum I don't need to manually go over all its elements? I don't want to use extend (subclass) as they belong to different package.

Thanks!

A: 

What you are talking about is a "Dynamic Enum".

Here is a link to a previous question here at StackOverflow.

saunderl
+1 for a good reference, but that one is C# specific and OP hasn't specified a language. It also doesn't have an accepted answer yet. OP, which language are you targetting?
LeonixSolutions
Sorry <shamefaced>
saunderl
A: 

Since you don't specify a lnguage it is very difficult to help you, but I suspect that what you want to do might be easier in interpreted languages than compiled.

LeonixSolutions