Compile time constants

N

newscorrespondent

Is there a way with Visual Studio 2003 and 2005 to list the name a value of
compile time constants like those created with #define statements.

Right now I have the need to use the same C# code in 2003 and 2005 and need
to know which version is doing the work. I could create one but if there is
already one there I would rather use it.


Thanks
 
J

Jon Skeet [C# MVP]

Is there a way with Visual Studio 2003 and 2005 to list the name a value of
compile time constants like those created with #define statements.

Right now I have the need to use the same C# code in 2003 and 2005 and need
to know which version is doing the work. I could create one but if there is
already one there I would rather use it.

The "pre-processor" symbols in C# don't have values. However, you could
do:

#if VS2003
const int Version = 2003;
#else
const int Version = 2005;
#endif

I don't believe there's anything in the default project settings to
define "VS2003" or anything like that, but you can easily put them in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top