BitConverter.GetBytes(int)和BitConverter.ToString 方法 (Byte[])


BitConverter.ToString 方法 (Byte[])

网址:https://msdn.microsoft.com/zh-cn/library/3a733s97(v=vs.110).aspx

BitConverter.GetBytes(int)

网址:http://www.cnblogs.com/skyivben/archive/2011/01/14/1935594.html

一、

byte[ ] arrayOne = {
             0,   1,   2,   4,   8,  16,  32,  64, 128, 255 };
Console.WriteLine( BitConverter.ToString(arrayOne) );
输出:00-01-02-04-08-10-20-40-80-FF

二、
long n = 0x1234567890ABCDEF;
Console.WriteLine(n.ToString("X") + ": " + BitConverter.ToString(BitConverter.GetBytes(n)));
输出:1234567890ABCDEF: EF-CD-AB-90-78-56-34-12

转换为的数组是:int的低位开始


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM