本文实例讲述了C#将字节数组转换成数字的方法。分享给大家供大家参考。具体实现方法如下:
// Create a decimal from a byte array
public static decimal ByteArrayToDecimal (byte[] src) {
// Create a MemoryStream containing the byte array
using (MemoryStream stream = new MemoryStream(src)) {
//
最近在使用结构体与字节数组转化来实现socket间数据传输。现在开始整理一下。对于Marshal可以查阅msdn,关于字节数组与结构体转代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
namespace FileSendClient
{
[Stru