728x90
728x170
■ Enumerable 클래스의 Concat<T> 확장 메소드를 사용해 배열을 복사하는 방법을 보여준다.
▶ 예제 코드 (C#)
Random random = new Random(DateTime.Now.Millisecond);
byte[] sourceArray1 = new byte[1000000];
byte[] sourceArray2 = new byte[1000000];
byte[] sourceArray3 = new byte[1000000];
byte[] targetArray = new byte[3000000];
for(int i = 0; i < 1000000; i++)
{
sourceArray1[i] = (byte)random.Next(0, 255);
sourceArray2[i] = (byte)random.Next(0, 255);
sourceArray3[i] = (byte)random.Next(0, 255);
}
IEnumerable<byte> targetEnumerable = sourceArray1.Concat(sourceArray2).Concat(sourceArray3);
728x90
그리드형(광고전용)