Enums across multiple projects


R

Rathtap

Suppose I have the following enum that I need in multiple projects:

enum Ratings{Poor=1,Satisfactory,Medium,Good,Excellent};

Instead of defining it in every project that needs it, I want to
create it in one and have it accessible from the others. How do I do
it?
 
Ad

Advertisements

C

cody

You have to compile the project which contains the definition of your enum
as dll.
Then you can add in the other projects a reference to this dll, and now you
can use this enum is this projects.
 
Ad

Advertisements

N

Nicholas Paldino [.NET/C# MVP]

Rathtap,

All you have to do is define it in an assembly, and reference that
assembly among all those projects that you want to use it in.

Hope this helps.
 

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

Top