Max HEX value for long type
问题 I have ported Java code to C#. Could you please explain why I have compile-time error in the follow line (I use VS 2008): private long l = 0xffffffffffffffffL; // 16 'f' got here Cannot convert source type ulong to target type long I need the same value here as for origin Java code. 回答1: Assuming you aren't worried about negative values, you could try using an unsigned long: private ulong l = 0xffffffffffffffffL; In Java the actual value of l would be -1 , because it would overflow the 2^63 -