[英]How to convert an Int64 to BigInteger in Mono C#?
在MS C#中,以下构造函数工作:
Int64 a = 123;
BigInteger bi = new BigInteger(a);
这在Mono中不起作用。 编译抱怨它无法从long转换为BigInteger(CS1502,CS1503)。
反正有没有这样做?
请参阅Mono上的BigInteger构造函数, http: //docs.go-mono.com/?link = T%3aaMono.Math.BigInteger%2fC
BigInteger()
BigInteger(BigInteger)
BigInteger(byte[])
BigInteger(uint)
BigInteger(uint[])
BigInteger(ulong)
BigInteger(BigInteger, uint)
BigInteger(BigInteger.Sign, uint)
没有构造函数接受long (which is the same as Int64)
尝试BigInteger bi = new BigInteger((ulong)a);
或BigInteger bi = new BigInteger((uint)a);
Mono.Math.BigInteger只有构造函数接受ulong。 是不是System.Numerics.BigInteger你想用吗?
https://github.com/mono/mono/blob/master/mcs/class/System.Numerics/System.Numerics/BigInteger.cs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.