Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Enums?

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
Is it possible to create dynamic enumerators?

Like, get a list of items out of a database and create an enumerator from them instead of hard coding them in the code?

D
 
Yes, but it's not worth the very large effort required.

Basically, you would retrieve the list from the database, then create a source module (*.vb) dynamically (i.e. via string concatenation) that contains your enum, then call the vb or CSharp compiler (csc.exe), then late-bind to the resulting assembly.

Try using an ArrayList collection instead.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
OMG, thats way too much overhead.

I have a co-worker thats enum crazy, although I think that using collections would be much easier. Just wasn't sure if maybe there was an easy way to get the best of both worlds.

Apparantly there isn't.
;)

Thanks Chip.

D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top