SimplexTeam

  • 增加字體大小
  • 預設字體大小
  • 減少字體大小
Home 程設小技巧 VisualBasic.NET小技巧 在VB.NET中將各原生型態(如Integer)轉換至Byte陣列

在VB.NET中將各原生型態(如Integer)轉換至Byte陣列

列印
在VB.NET中將各原生型態(如Integer)轉換至Byte陣列
我們會使用BitConverter
在BitConverter中有一函數GetBytes()
此函數有10種版本~
每個版本都只有一個參數~
用法如下:
byte_array = BitConverter.GetBytes(value)
傳入一個參數並將其轉為Byte陣列傳回
其中value可以為以下型態:
Boolean, Char, Int16, Int32, Int64, UInt16, UInt32, UInt64, Single, Double
 

廣告