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