Mega Code Archive

 
Categories / C# / Collections Data Structure
 

Concatenate Array

using System; namespace tera.commons.extensions {     public static class ByteArrayExtensions     {         public static byte[] Concatenate(this byte[] _Array, params byte[][] _Others)         {             int length = _Array.Length;             for (int index = 0; index < _Others.Length; ++index)                 length += _Others[index].Length;             byte[] result = new byte[length];             Buffer.BlockCopy(_Array, 0, result, 0, _Array.Length);             for (int offset = _Array.Length, index = 0; index < _Others.Length; offset += _Others[index].Length, ++index)                 Buffer.BlockCopy(_Others[index], 0, result, offset, _Others[index].Length);             return result;         }     } }