How to reuse enum-definition?

K

Kenneth

I want to define an enum for possible languages in my application. My
enum look like this:

Public Enum Languages
English = 0
Portuguese = 1
End Enum

How can i reuse this enum in the rest of my application (in different
classes in different projects)?

I have tried to make a specific class for this:

Public Class Languages

Public Enum Languages
English = 0
Portuguese = 1
End Enum

End Class

I can then inherit this class from other classes and use the enum. But
this does not work when I want to use the enum in a form. The form
already inherits: System.Windows.Forms.Form and can only inherit from
one class.

I originally put the enum in a startup module. This way I made it
global and could use it within my UserInterface project. But then I
could not use it in the other projects (entity and business tier
project).

How do i define enum just once and be able to use different places?
 
C

cody

You do not have to wrap the enum in a class you can use it from any other
projects provided your enum is public and and you created assembly where the
enum is defined in as a dll.
 
K

Kenneth Agerskov

Thanks cody. That sounds good. Unfortunately I dont know how to create
an assembly as you mention. Can you please help me?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top