开发者

Convert Int64 to binary and back?

Is there a way to convert Int64 to 开发者_StackOverflowbinary and back to Int64?


var bytes = BitConverter.GetBytes(long);
var value = BitConverter.ToInt64(bytes, 0);


if string formatting is what you need:

Convert.ToString(someInt64, 2);
Convert.ToUInt64("101010", 2);


Similar to HuBeZa's answer, this converts type long to string:

Convert.ToString(Convert.ToInt64(myLongInt), 2);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜