473,614 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
--
mo*******@nospa m.com
Nov 21 '05 #1
4 3294
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:
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.
--
mo*******@nospa m.com

Nov 21 '05 #2
"moondaddy" <mo*******@nosp am.com> schrieb:
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?


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/>
Nov 21 '05 #3
Thanks. thats what I needed.

--
mo*******@nospa m.com
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"moondaddy" <mo*******@nosp am.com> schrieb:
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?


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/>

Nov 21 '05 #4
Thanks. thats what I needed.

--
mo*******@nospa m.com
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"moondaddy" <mo*******@nosp am.com> schrieb:
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?


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/>

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3798
by: Pierre Couderc | last post by:
I want to share enum between 2 classes C1 and C2: class C1 { public: enum shut {AAA,BBB, CCC}; shut m_C1; void set(shut &s) { m_C1=s;} };
5
2063
by: Rich | last post by:
Hi there, For a quite big application, I need to get large amount of data within a static library (xxx.lib) and put them in a database (a class, say we call it CData), and then make it accessible by a few different dynamic library files (yyy.dll, …). I’ve tried to create a global class object of CData*, say pData, by declaring it as an external in the header and initiate it in the cpp of a dll file. But it doesn’t work. Other dlls...
4
1439
by: | last post by:
Hi, Im running IIS and all my data is stored on a network share e.g \\10.0.0.111\domain.com\main The problem i'm facing is that i dont know how to point my aspx.vb files to any dlls in the bin folder, no matter where i place the bin folder. Nothing is stored on the IIS server, everything is on the network share. When i create an application, i can change the codebehind to src=file.aspx.vb, this finds the vb files. But how do i tell my...
7
3351
by: Tiraman | last post by:
Hi , I have 2 Questions About Using Enum 1) i have the following Enum under my class but if i need to use it i must use it like this ConstantsFileSystem.CREATE_FILE how can i use it just by the const name by doing like this CREATE_FILE
0
2585
by: aloneplayer | last post by:
Hi, All, I wrote a function to share a folder to individual user account with WMI. When I call it : ShareFolder("c:\\test", "Test", "Shared by Riven", 8, Environment.MachineName, "Administrator"); The folder will be shared, but nobody has permission to access it. (The share permissions list of this folder is empty) Could you help me?
3
3134
by: Bob Peek | last post by:
I would like to share code between several web sites that exist as virtual directories under a single site. It appears that I have to create an app_code directory under each virtual root in order to share classes accross the code in the different virtual directories. This seems to defeat the purpose of shared code. Is there any way to specify to IIS where the app_code directory is for a virtual site?
2
1461
by: =?Utf-8?B?ZGlhdG9tQG5ld3Nncm91cC5ub3NwYW0=?= | last post by:
Hello, I would like to create an enum that can be used accross all the classes in my windows solution. How can I do this. TROUBLESHOOTING I created a new .cs file in my windows solution. I call it Enumerations.cs. In this file I have written the following... using System;
6
4580
by: =?Utf-8?B?RmFiaWFu?= | last post by:
Hello, I have a class hierarchy distributed over 3 native C++ dlls. The base class has a .NET Windows.Form for status output via a gcroot<>. The gcroot is declared private - the sub classes only have access via a protected "print"-method. I need the different dlls as the sub classes implement the base class's pure virtual methods using different technologies. To use the native classes from outside their dlls I use the...
2
1466
by: puzzlecracker | last post by:
I am porting old java code to csharp and now facing a stumbling block. Before advent of enum in Java, developers used enum-like structures, shown below. However, AFAIK, CSharp isn't lacking this particular feature, and I don't want to port it in an old way. Here is the code below (in java ) that I want to approximate in C#. Note that I have lots of classes that follow this sort of principles. public class Derived extends Base {
0
8182
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8130
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8627
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8279
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8433
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7093
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6088
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1425
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.