[C#] C#将字节数组转换成数字 →→→→→进入此内容的聊天室

来自 , 2019-04-15, 写在 C#, 查看 110 次.
URL http://www.code666.cn/view/68cfb8f8
  1. // Create a decimal from a byte array
  2. public static decimal ByteArrayToDecimal (byte[] src) {
  3.  
  4.     // Create a MemoryStream containing the byte array
  5.     using (MemoryStream stream = new MemoryStream(src)) {
  6.  
  7.         // Create a BinaryReader to read the decimal from the stream
  8.         using (BinaryReader reader = new BinaryReader(stream)) {
  9.  
  10.             // Read and return the decimal from the
  11.             // BinaryReader/MemoryStream
  12.             return reader.ReadDecimal();
  13.         }
  14.     }
  15. }
  16. //csharp/7766

回复 "C#将字节数组转换成数字"

这儿你可以回复上面这条便签

captcha