473,387 Members | 1,532 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,387 software developers and data experts.

c++ style #define in c#

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
Nov 16 '05 #1
1 1415
Blacky wrote:
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/
Nov 16 '05 #2

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

Similar topics

12
by: David MacQuigg | last post by:
I have what looks like a bug trying to generate new style classes with a factory function. class Animal(object): pass class Mammal(Animal): pass def newAnimal(bases=(Animal,), dict={}):...
5
by: BenOne© | last post by:
Hi all, If I want to have many divs with different padding, border, and colour properties, should I just set those styles in line, ie: <DIV style"..."> </DIV> or should I define all the divs...
4
by: Nobody | last post by:
Lets say I have a class that is only available if a specific DLL (a.dll) is present. I can't link to that DLL through lib files or my app will fail on any machine that doesn't have a.dll. So I...
43
by: Sensei | last post by:
Hi! I'm thinking about a good programming style, pros and cons of some topics. Of course, this has nothing to do with indentation... Students are now java-dependent (too bad) and I need some...
4
by: Shaul Feldman | last post by:
Hello, I have something really awkward at work - fighting with CheckBoxList... How can I define CSS for ListItem in CheckBoxList programmatically. I add CheckBoxList's Items on the fly, something...
7
by: Rob Nicholson | last post by:
We're using a well known presentation layer library to implement complex controls on an intranet site. IE has the following limitation which effectively means that you can only have 30 <STYLE> tags...
17
by: blackswift | last post by:
code is from Warsaw university's CEPC code . They are world champion in the ICPC finals. #include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define FOR(i,a,b)...
3
by: Shimon Sim | last post by:
I need to add few style properties to my custom control. The properties I added look like this. private Style titleStyle = new Style(); public Style TitleStyle
7
by: Ioannis Vranos | last post by:
I think I read somewhere that #define constants in the style #define SOMETHING 6 are evaluated to long or unsigned long, depending on the situation and not int.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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
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
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
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...

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.