No preprocessor in C#. So your out of luck for traditional defines. I usually make an internal static class with the consts...
Thanks, Shawn Wildermuth [EMAIL PROTECTED] > -----Original Message----- > From: Moderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED]] On Behalf Of Noam Arbel > Sent: Wednesday, July 03, 2002 7:42 PM > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] Defining fixed variables > > > Hello, > > I have a conceptual question: > > In C++ we used to do > > #define THIS_VAL 10 > #define MAX_THAT 255 > > and so on. Those where substituted by the compiler with no > runtime cost. > > Is the an equivalent in C#? > > One solution is to create a class with all static const > variables (it that even allowed?). But there are 2 issues > with that; one is that the assignment is done at runtime (or > is the compiler smart enough to assign at compile time). The > second is that this class takes up memory. > > Any better ideas? > > > thanks, > > Noam > > You can read messages from the Advanced DOTNET archive, > unsubscribe from Advanced DOTNET, or subscribe to other > DevelopMentor lists at http://discuss.develop.com. > You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
