Max HEX value for long type

前端 未结 4 1892
情书的邮戳
情书的邮戳 2021-01-21 23:38

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 = 0xffffffffffffffff         


        
4条回答
  •  天涯浪人
    2021-01-21 23:48

    You could do this:

    private long l = long.MaxValue;
    

    ... but as mdm pointed out, you probably actually want a ulong.

    private ulong l = ulong.MaxValue;
    

提交回复
热议问题