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. C#
  4. Playing with Enumerations

Playing with Enumerations

Scheduled Pinned Locked Moved C#
helpdesign
7 Posts 4 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.
  • E Offline
    E Offline
    ezazazel
    wrote on last edited by
    #1

    Hi guys! Maybe someone can help me with this: I have a library C which controls a device and it's methods take enumerations as parameters. Then I have a library B which references C and "wraps" the complex commands from library C in something useful and maintainable. The last thing I have is an assembly A which does the UI stuff. It references ONLY library B. Nevertheless B needs the values of the enumerations of C to control the device (and to fill comboboxes with the enum-Values) I need a way to pass the information, which value of an enumeration is needed from A to B. I do not want to reference C in A (that's how I would get the enumerations as well). Which would be a good approach to solve this problem. Help would really be appreciated!

    L G P 3 Replies Last reply
    0
    • E ezazazel

      Hi guys! Maybe someone can help me with this: I have a library C which controls a device and it's methods take enumerations as parameters. Then I have a library B which references C and "wraps" the complex commands from library C in something useful and maintainable. The last thing I have is an assembly A which does the UI stuff. It references ONLY library B. Nevertheless B needs the values of the enumerations of C to control the device (and to fill comboboxes with the enum-Values) I need a way to pass the information, which value of an enumeration is needed from A to B. I do not want to reference C in A (that's how I would get the enumerations as well). Which would be a good approach to solve this problem. Help would really be appreciated!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You could just copy 'n paste the enum .. but that makes it harder to add/change values later (there are probably better solutions..)

      1 Reply Last reply
      0
      • E ezazazel

        Hi guys! Maybe someone can help me with this: I have a library C which controls a device and it's methods take enumerations as parameters. Then I have a library B which references C and "wraps" the complex commands from library C in something useful and maintainable. The last thing I have is an assembly A which does the UI stuff. It references ONLY library B. Nevertheless B needs the values of the enumerations of C to control the device (and to fill comboboxes with the enum-Values) I need a way to pass the information, which value of an enumeration is needed from A to B. I do not want to reference C in A (that's how I would get the enumerations as well). Which would be a good approach to solve this problem. Help would really be appreciated!

        G Offline
        G Offline
        Gideon Engelberth
        wrote on last edited by
        #3

        Why not reference C in A? If B references C and A references B, then you have to distribute C with application A anyway. If you want A to have access to the values of the enumeration, referencing C is the 'right' and easiest way to go about it.

        E 1 Reply Last reply
        0
        • E ezazazel

          Hi guys! Maybe someone can help me with this: I have a library C which controls a device and it's methods take enumerations as parameters. Then I have a library B which references C and "wraps" the complex commands from library C in something useful and maintainable. The last thing I have is an assembly A which does the UI stuff. It references ONLY library B. Nevertheless B needs the values of the enumerations of C to control the device (and to fill comboboxes with the enum-Values) I need a way to pass the information, which value of an enumeration is needed from A to B. I do not want to reference C in A (that's how I would get the enumerations as well). Which would be a good approach to solve this problem. Help would really be appreciated!

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          I would put the enum in A; but you could put the enum in D.

          E 1 Reply Last reply
          0
          • P PIEBALDconsult

            I would put the enum in A; but you could put the enum in D.

            E Offline
            E Offline
            ezazazel
            wrote on last edited by
            #5

            Thanks for the hint, unfortunately I can't do this due to he fact, that lib C wasn't written by me.

            P 1 Reply Last reply
            0
            • G Gideon Engelberth

              Why not reference C in A? If B references C and A references B, then you have to distribute C with application A anyway. If you want A to have access to the values of the enumeration, referencing C is the 'right' and easiest way to go about it.

              E Offline
              E Offline
              ezazazel
              wrote on last edited by
              #6

              Thanks for your reply. I just hoped it would be possible to separate the C2 logic from the UI with the lib B as link.

              1 Reply Last reply
              0
              • E ezazazel

                Thanks for the hint, unfortunately I can't do this due to he fact, that lib C wasn't written by me.

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                Then write your own in B, and then translate.

                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