Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Dynamic Enums... Is this possible?

Dynamic Enums... Is this possible?

Scheduled Pinned Locked Moved Visual Basic
databasedesignquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Ok, lets say you wanted to create a reusable class to communicate with a SQL database. This class has a method called "OpenConnection" wich accepts an aritrary amount of parameters buy you want one of these parameters to be an enumeration of the avialable SQL servers. In other words, you want a drop down list of all servers available at design time. A dynamic enum within the class would work great buy I dont know if it is possible. Is there any way to accomplish this?

    C 1 Reply Last reply
    0
    • A Anonymous

      Ok, lets say you wanted to create a reusable class to communicate with a SQL database. This class has a method called "OpenConnection" wich accepts an aritrary amount of parameters buy you want one of these parameters to be an enumeration of the avialable SQL servers. In other words, you want a drop down list of all servers available at design time. A dynamic enum within the class would work great buy I dont know if it is possible. Is there any way to accomplish this?

      C Offline
      C Offline
      Charlie Williams
      wrote on last edited by
      #2

      Enums are simply a cleaner and more maintainable version of constants. If you were to create an enum at runtime (which is possible, using dynamic compilation or Reflection.Emit) what exactly would you do with it? How would you test for it in your calling method? Is there a reason you method can't accept a string array which contains the names of your servers as a parameter? Charlie if(!curlies){ return; }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups