Re: #defines
From: Štefan Šimek (simek.blah_at_kascomp.blah.sk)
Date: 10/11/04
- Next message: Jon Skeet [C# MVP]: "Re: How do i get the namespace at compile time?"
- Previous message: Jon Skeet [C# MVP]: "Re: #defines"
- In reply to: Philip: "#defines"
- Next in thread: Chuck: "Re: #defines"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 11 Oct 2004 15:44:02 +0200
You're right. The #define directive in C# is used for conditional
compilation only.
You should use enum's instead, for example:
[Flags]
public enum Perm
{
Value1 = 0x00000001,
PSSUser = 0x00000002,
BackupUser = 0x00000004
};
The [Flags] attribute is a hint for the compiler that binary operations (&,
|, ^, ~) can be applied to the enum members.
HTH,
Stefan
"Philip" <philip@softwareforever.com> wrote in message
news:4C468FAA-0B77-4E3E-AC1B-05D8F152A40E@microsoft.com...
> From other postings I am of the impression that C# does not support
> #define
> directives for the purposes of defining bit mask definitions such as the
> following...
>
> #define val10x00000001
> #define PermPSSUser 0x00000002
> #define PermBackupUser 0x00000004
> --
> Philip
- Next message: Jon Skeet [C# MVP]: "Re: How do i get the namespace at compile time?"
- Previous message: Jon Skeet [C# MVP]: "Re: #defines"
- In reply to: Philip: "#defines"
- Next in thread: Chuck: "Re: #defines"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|