Join Byte Array - CSharp System

CSharp examples for System:Byte Array

Description

Join Byte Array

Demo Code


using System.Collections.Generic;
using System;//  ww  w. j  ava2s . co  m

public class Main{
        private static byte[] JoinBytes(List<byte[]> listBytes)
        {
            int totalLength = 0;
            foreach (byte[] bytes in listBytes) totalLength += bytes.Length;
            byte[] result = new byte[totalLength];
            int position = 0;
            foreach (byte[] bytes in listBytes)
                for (int i = 0; i < bytes.Length; i++)
                {
                    result[position] = bytes[i];
                    position++;
                }
            return result;
        }
}

Related Tutorials