Rama Tito
asked on
how to use #define in window form in C#
Hi,
Every time when i declare #define TITO 2;
error message -> cannot define/ undefine preprocessor sysmbols after first token file. Is there any error on define method?
Every time when i declare #define TITO 2;
error message -> cannot define/ undefine preprocessor sysmbols after first token file. Is there any error on define method?
ASKER
Thats mean i can't declare #define. Instead of using #define, i must use public const ?
What are you using the #define for? If you are trying to use it for conditional compilation, then there are other ways to define...
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
2. The #define directive cannot be used to declare constant values as is typically done in C and C++. Constants in C# are best defined as static members of a class or struct. If you have several such constants, consider creating a separate "Constants" class to hold them.
See:
http://msdn.microsoft.com/en-us/library/47hya4cw%28v=vs.71%29.aspx
http://msdn.microsoft.com/ru-ru/library/yt3yck0x.aspx