CSharp examples for System:Byte Array
Join list of byte array
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System.Collections.Generic; using System;// w w w. j av a2 s . c om public class Main{ internal static byte[] Join(IList<byte[]> chunks) { int size = 0; checked { for (var i = 0; i < chunks.Count; i++) { var chunk = chunks[i]; if (chunk != null) { size += chunk.Length; } } } var result = new byte[size]; var seek = 0; for (var i = 0; i < chunks.Count; i++) { var chunk = chunks[i]; var chunkLength = chunk.Length; Array.Copy(chunk, 0, result, seek, chunkLength); seek += chunkLength; } return result; } }