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

  • Thread starter Thread starter Dev
  • Start date Start date
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
 
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
 
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.
 
Back
Top