How to share an Enum accross DLLs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • moondaddy

    How to share an Enum accross DLLs

    I have some pubic Enums I like to use throughout my application. Now I'm
    parsing the application out into smaller DLLs or projects. How an I share a
    common Enum across all the projects?

    Thanks.


    --
    moondaddy@nospa m.com


  • Dennis

    #2
    RE: How to share an Enum accross DLLs

    You should be able to share the Enums if you declare them public in the Class
    module before the Class statement. For ezample, in a class module or class
    library, etc.

    Imports ...............
    Imports ..............
    Public Enum myenum
    First
    Second
    End Enum

    Public Class MyClass
    ............
    ............
    End Class

    "moondaddy" wrote:
    [color=blue]
    > I have some pubic Enums I like to use throughout my application. Now I'm
    > parsing the application out into smaller DLLs or projects. How an I share a
    > common Enum across all the projects?
    >
    > Thanks.
    >
    >
    > --
    > moondaddy@nospa m.com
    >
    >
    >[/color]

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: How to share an Enum accross DLLs

      "moondaddy" <moondaddy@nosp am.com> schrieb:[color=blue]
      >I have some pubic Enums I like to use throughout my application. Now I'm
      >parsing the application out into smaller DLLs or projects. How an I share
      >a common Enum across all the projects?[/color]

      Implement the enum in one project and then add a reference to the project
      from the other class library projects. Import the namespace containing the
      enum and use it ;-). To add a project reference, select the project in
      solution explorer and choose "Add reference..." from its context menu. In
      the "Add reference..." dialog select the "Projects" tab and add the
      reference.

      Notice that it's important to define the enumeration only in one of the DLLs
      and then use this enumeration instead of defining an enum with the same name
      in each of the DLLs.

      --
      Herfried K. Wagner [MVP]
      <URL:http://dotnet.mvps.org/>


      Comment

      • moondaddy

        #4
        Re: How to share an Enum accross DLLs

        Thanks. thats what I needed.

        --
        moondaddy@nospa m.com
        "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
        news:%238Er2Wf2 EHA.2824@TK2MSF TNGP09.phx.gbl. ..[color=blue]
        > "moondaddy" <moondaddy@nosp am.com> schrieb:[color=green]
        >>I have some pubic Enums I like to use throughout my application. Now I'm
        >>parsing the application out into smaller DLLs or projects. How an I share
        >>a common Enum across all the projects?[/color]
        >
        > Implement the enum in one project and then add a reference to the project
        > from the other class library projects. Import the namespace containing
        > the enum and use it ;-). To add a project reference, select the project
        > in solution explorer and choose "Add reference..." from its context menu.
        > In the "Add reference..." dialog select the "Projects" tab and add the
        > reference.
        >
        > Notice that it's important to define the enumeration only in one of the
        > DLLs and then use this enumeration instead of defining an enum with the
        > same name in each of the DLLs.
        >
        > --
        > Herfried K. Wagner [MVP]
        > <URL:http://dotnet.mvps.org/>
        >[/color]


        Comment

        • moondaddy

          #5
          Re: How to share an Enum accross DLLs

          Thanks. thats what I needed.

          --
          moondaddy@nospa m.com
          "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
          news:%238Er2Wf2 EHA.2824@TK2MSF TNGP09.phx.gbl. ..[color=blue]
          > "moondaddy" <moondaddy@nosp am.com> schrieb:[color=green]
          >>I have some pubic Enums I like to use throughout my application. Now I'm
          >>parsing the application out into smaller DLLs or projects. How an I share
          >>a common Enum across all the projects?[/color]
          >
          > Implement the enum in one project and then add a reference to the project
          > from the other class library projects. Import the namespace containing
          > the enum and use it ;-). To add a project reference, select the project
          > in solution explorer and choose "Add reference..." from its context menu.
          > In the "Add reference..." dialog select the "Projects" tab and add the
          > reference.
          >
          > Notice that it's important to define the enumeration only in one of the
          > DLLs and then use this enumeration instead of defining an enum with the
          > same name in each of the DLLs.
          >
          > --
          > Herfried K. Wagner [MVP]
          > <URL:http://dotnet.mvps.org/>
          >[/color]


          Comment

          Working...