Combines 2 byte arrays into 1 major byte array - CSharp System

CSharp examples for System:Byte Array

Description

Combines 2 byte arrays into 1 major byte array

Demo Code



public class Main{
        /// <summary>
        /// Combines 2 arrays into 1 major array
        /// </summary>
        /// <param name="a">Array 1</param>
        /// <param name="b">Array 2</param>
        /// <returns></returns>
        public static byte[] combineArrays(byte[] a, byte[] b)
        {//  w  ww  . j av a  2 s  .com
            byte[] c = new byte[a.Length + b.Length];
            System.Buffer.BlockCopy(a, 0, c, 0, a.Length);
            System.Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
            return c;
        }
}

Related Tutorials