我对ulong类型的行为有点困惑。我理解它是一个用于正数的64 位整数(最大值 18,446,744,073,709,551,615)。我刚开始使用它是因为我需要非常大的正数,但是在潜在的负数周围有一些我不明白的奇怪行为。
ulong big = 1000000; //Perfectly legal
ulong negative = -1; //"Constant value "-1" cannot be converted to a ulong" Makes sense
//Attempt to sneak around the -1 as a constant compile-time error
int negativeInt = -1;
ulong negativeUlongFail = negativeInt; //"Cannot implicitly convert 'int' to 'ulong'.
//An explicit conversion exists (are you missing a cast?)"
//So I add casting
ulong negativeUlong = (ulong)negativeInt; //But this yields 18446744073709551615
//Try and get a …Run Code Online (Sandbox Code Playgroud) 也许我错过了一些非常明显的东西,但我进入了我的通知设置,找不到任何关于当人们关注你时收到电子邮件的信息。我可以随时转到我的个人资料上的“关注者”选项卡,查看当前关注我的人,但我想获取更新。
我发现有新人关注我的唯一方法是无意中访问普通的GitHub.com并浏览我的活动。