I sometimes wish they would have kept some features from c++ in C#. Anyways, I was trying to try an old c/c++ trick:

#define SUM 1

but it does not work in c#. Anybody know how to declare symbols in c#?

Recommended Answers

All 5 Replies

In C# there is no separate preprossesing step like in C or C++.
#define looks like in C/C++ but it's not all the same.
You can use it for conditional compilation like:
#define DEBUG

and then
#if DEBUG
bla bla
#else
blo blo

does this mean that the following lines are possible:

#define DEBUG

#if DEBUG
    return 1;

I meant to ask can i return an integer value if Debug comes up? if yes, then how??

Your code must be ended with #endif directive, my first example was not complete, sorry for that.

!!k thanks!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.