473,320 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

#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 3253
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
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
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
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
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
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.