合并byte数组

using System;
using System.Collections;
using System.Text;

namespace Test
{
	class TestArray
	{
		static void Main(string[] args)
		{
			byte[] arr1 = Encoding.Default.GetBytes("abc");
			byte[] arr2 = Encoding.Default.GetBytes("123");

			ArrayList list = new ArrayList(arr1);
			list.AddRange(arr2);
			byte[] all = list.ToArray(typeof(byte)) as byte[];

			Console.WriteLine(Encoding.Default.GetString(all));
		}
	}
}



原文地址:http://www.oschina.net/code/snippet_1261582_24509

你可能感兴趣的:(C#)