I use Enum flags in my application. Enum can have about 50+ values, so the values reach 2 ^ 50. I'm just wondering if I can use Math.Pow(2, variable) to calculate them?
When I try to do this, I get a constant compile-time error. Is there any other way besides calculating these permissions 2 manually and entering it?
That's what I'm doing:
[Flags] internal enum RiskStates : long { None = 0, AL = Convert.ToInt64(Math.Pow(2,0)), AK = 2, AZ = 4, AR = 8, CA = 16, CO = 32, CT = 64, DC = 128, DE = 256, FL = 512, GA = 1024, HI = 2048, ID = 4096, IL = 8192, IN = 16384, IA = 32768, KS = 65536, KY = 131072, LA = 262144, ME = 524288, MD = 1048576, MA = 2097152, MI = 4194304 }
enums c # flags
Charu Sep 26 '13 at 7:20 2013-09-26 07:20
source share