c++ style #define in c#

  • Thread starter Thread starter Blacky
  • Start date Start date
B

Blacky

Hi

I used to use #define in c and c++ to do this...
#define Code 1
#define Name 2

then later in program

strCode = List.Items
Code:
;
strName = List.Items[Name];

Then when ever they change around, all I changed was the defines. They would
be change in code before compiling. It was easy and simple and worked very
well with out using any memory or creating unnecessary instances.

No I see in C# that does not work anymore. Is there anything else I can use
that will be done pre-compile? Do not want to make class and then create an
instance. That is just wasting time, and memory.

Thank you very much.
Nick
 
Blacky said:
I used to use #define in c and c++ to do this...
#define Code 1
#define Name 2
...
No I see in C# that does not work anymore. Is there anything else I
can use that will be done pre-compile? Do not want to make class and
then create an instance. That is just wasting time, and memory.

public const int Code = 1;
public const int Name = 2;

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp

Do you need daily reports from your server ?
http://sourceforge.net/projects/srvreport/
 
Back
Top