Flatten array of byte array - CSharp System

CSharp examples for System:Byte Array

Description

Flatten array of byte array

Demo Code

// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;

public class Main{
        public static byte[] Flatten(this IEnumerable<byte[]> segments)
        {/*from w w  w  . ja  v a2s . co m*/
            List<byte> bytes = new List<byte>();
            foreach (var segment in segments)
            {
                bytes.AddRange(segment);
            }
            return bytes.ToArray();
        }
}

Related Tutorials