C#( Is it possible to add the Enum in dynamically?)

D

Dev

Dear Friends,
Is it possible to add the Enum in dynamically.
Like Ex:
enum Colors
{
Green, Red,Yellow,Blue,Orange
}
So i want add 6th name Black to Colors.Is it possible? If so how?...If anyone knows please let me know....

Thanks,
Dev
 
N

Nicholas Paldino [.NET/C# MVP]

Dev,

No, it is not. There would be no way for other developers to know how
to use it as it would not be available at dev time, or at compile time.

What are you trying to do?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dear Friends,
Is it possible to add the Enum in
dynamically.
Like Ex:
enum Colors
{
Green, Red,Yellow,Blue,Orange
}
So i want add 6th name Black to Colors.Is it possible? If so how?...If
anyone knows please let me know....

Thanks,
Dev
 
C

Chris Hornberger

You're looking to have runtime-configured data domains. To do that use
a custom data container class that wraps a Hashtable. Hashtables are
key-value type containers and the keys are unique so they lend
themselves nicely to this problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top