473,491 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

#defines

sorry.... hit the enter key prematurely on the other post.

From other postings I am assuming that C# #defines can not be used for bit
mask definitions as follows...

#define Value 1 0x00000001
#define Value2 0x00000002
#define Value3 0x00000004

I am assuming that I need to define such definitions as perhaps static ints
in an assembly and reference the shared assembly. Please confirm.

Also .... when referencing the assembly... is there a means to reference the
assembly relative from the IIS application directory.... so if I move the
project from IIS server to another IIS server.... all relative references
will be maintained and continue to work.

Thanks

Philip
--
Philip
Nov 16 '05 #1
4 3271
Philip <ph****@softwareforever.com> wrote:
sorry.... hit the enter key prematurely on the other post.

From other postings I am assuming that C# #defines can not be used for bit
mask definitions as follows...

#define Value 1 0x00000001
#define Value2 0x00000002
#define Value3 0x00000004

I am assuming that I need to define such definitions as perhaps static ints
in an assembly and reference the shared assembly. Please confirm.
The above would usually by done as an enumeration with the [Flags]
attribute, but you could also use

public const int Value1 = 0x00000001;
public const int Value2 = 0x00000002;

etc
Also .... when referencing the assembly... is there a means to reference the
assembly relative from the IIS application directory.... so if I move the
project from IIS server to another IIS server.... all relative references
will be maintained and continue to work.


To be honest, I don't know much about ASP.NET deployment. If you supply
all the assemblies you want to use in the same directory as the
assembly which wants to use them, I would imagine that would be fine.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Philip,

Use an enum instead:

[Flags]
enum MyFlags
{
Value1 = 0x00000001,
Value2 = 0x00000002,
Value3 = 0x00000004
}

Regards,
Chris.

"Philip" wrote:
sorry.... hit the enter key prematurely on the other post.

From other postings I am assuming that C# #defines can not be used for bit
mask definitions as follows...

#define Value 1 0x00000001
#define Value2 0x00000002
#define Value3 0x00000004

I am assuming that I need to define such definitions as perhaps static ints
in an assembly and reference the shared assembly. Please confirm.

Also .... when referencing the assembly... is there a means to reference the
assembly relative from the IIS application directory.... so if I move the
project from IIS server to another IIS server.... all relative references
will be maintained and continue to work.

Thanks

Philip
--
Philip

Nov 16 '05 #3
Hi,
#define Value 1 0x00000001
#define Value2 0x00000002
#define Value3 0x00000004

I am assuming that I need to define such definitions as perhaps static ints in an assembly and reference the shared assembly. Please confirm.
See the other posts regarding how to define these in C#, where to place them
depend of how you are going to use them, you can include them in an assembly
(dll) that will be used by other assemblies, maybe in your case your
solution has two projects, one is a DLL ( with the above definitions) and
the other is the web app that has a reference to the dll.
Also .... when referencing the assembly... is there a means to reference the assembly relative from the IIS application directory.... so if I move the
project from IIS server to another IIS server.... all relative references
will be maintained and continue to work.

Thanks

Philip


If you compile your project with a reference to the shared assembly then
you don;t have any problem, you don't have to reference any assembly (in
code).

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Nov 16 '05 #4
use an enum ...

enum Values
{
Value1 = 0x00000001,
Value2 = 0x00000002,
Value3 = 0x00000004
}

For ASP.NET, just drop the assembly into the bin directory directly under the virtual root.

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<29**********************************@microsoft.co m>

sorry.... hit the enter key prematurely on the other post.

From other postings I am assuming that C# #defines can not be used for bit
mask definitions as follows...

#define Value 1 0x00000001
#define Value2 0x00000002
#define Value3 0x00000004

I am assuming that I need to define such definitions as perhaps static ints
in an assembly and reference the shared assembly. Please confirm.

Also .... when referencing the assembly... is there a means to reference the
assembly relative from the IIS application directory.... so if I move the
project from IIS server to another IIS server.... all relative references
will be maintained and continue to work.

Thanks

Philip
--
Philip

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.775 / Virus Database: 522 - Release Date: 08/10/2004

[microsoft.public.dotnet.languages.csharp]
Nov 16 '05 #5

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

Similar topics

4
1621
by: Pelle Beckman | last post by:
Hi, I saw this code in an earlier post (not that there's anything wrong with it) #include <iostream> using std::cout; const int hour = 3600; const int min = 60;
7
2316
by: John Dolinka | last post by:
I have a project of several files with #defines to setup a conditional compile. I would like to put these #defines in a single file and change the conditional compile from this one file with the...
0
302
by: John Dolinka | last post by:
I have a project of several files with #defines to setup a conditional compile. I would like to put these #defines in a single file and change the conditional compile from this one file with the...
6
2603
by: Richard | last post by:
1. Are there any problems with having, for instance, POSIX's "open" function #defined more than once. In my case, these would be in different static libraries: #ifdef __cplusplus extern "C" {...
14
2460
by: Eliot | last post by:
I have a project which may be compiled with some #defines. Say:- #define firstdef #define seconddef If no defines are present or only one is present all is OK. I would like to add a self...
0
7115
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,...
0
6978
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...
0
7154
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,...
0
7190
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6858
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...
0
4578
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3086
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.