开发者

64bit Enums? C#

开发者 https://www.devze.com 2022-12-17 11:26 出处:网络
Is it possible to get an enum to hold 64bit values? I wrote the code below and got this compile error message.

Is it possible to get an enum to hold 64bit values? I wrote the code below and got this compile error message.

enum EnumTest { a = 0x100000000 };

error CS0266: Cannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are 开发者_Go百科you missing a cast?)


Yes, you need to "derive" it from long.

public enum MyEnum : long
{
}
0

精彩评论

暂无评论...
验证码 换一张
取 消