473,387 Members | 1,890 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.

How do you "#define" in C#?

Hi all,

How do you #define (as in C++) in C#?

Many thanks,
James

Nov 17 '05 #1
1 8199
Hi James,

The #define statement in C# is only used for defining symbols that can be
tested for existence with the other preprocessor directives, #if and #elif.

That is to say, you cannot use #define in the same way as C++. In C#, it is
only used to define a symbol used in preprocessor conditionals.

Please see the following article for a (probably better) description of
#define, in C# (URL may wrap):

http://msdn.microsoft.com/library/de...clrfdefine.asp

-- Tom

James wrote:
Hi all,

How do you #define (as in C++) in C#?

Many thanks,
James

Nov 17 '05 #2

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

Similar topics

2
by: Chris Hodapp | last post by:
I have seen messages posted about this before, and there is a clear reference to it in the manual, but I have been unable to find a solution. I'm on Slackware 9.1, kernel 2.6.0-test11, using...
3
by: xudeutsch | last post by:
I have such a block in C++ #pragma pack(push,4) #define STATE_NULL 0x0000 #pragma pack(pop) and I need to convert it to C#. I want to use the "MarshalAs" attribute, but i dont know which...
4
by: xudeutsch | last post by:
thanks, Nicholas and cody. but as far as i know, the following directive " #pragma pack(push,4)" will ensure that: when the data are transferred through networks to other platforms, the const...
4
by: paapa21 | last post by:
I want to Declear a variable as SqlDataReader in ASP 2.0. But when i do so it tells me SqlDataReader is not define. This same code works in my previous application in ASP 1.0. Has this change? Can...
14
by: Chen Shusheng | last post by:
CSS white here: Simply strange, I found "define" can not work with "malloc". Together my complier will say "parse error". Could anyone tell me why? ------------------------- #define MAX 10000...
17
by: Chen Shusheng | last post by:
Hi all, In fact, I want to let my memory run out. And see what will happen. My system is windowsXp. Memory is 256M.I think my cdes will apply more memory than I have. Codes are below: ...
2
by: slrj | last post by:
Can someone explain me what's going on in the code below. As per my knowledge "#define <macro name> <Macro replacement>" doesn't have a semicolon and it's terminated by a new line. But the code line...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.