合并两个byte[]

            byte[] ssHead = System.Text.Encoding.Unicode.GetBytes("This is Head:");
            byte[] ssContent = System.Text.Encoding.Unicode.GetBytes("This is Content.");

 

            //ssHead + ssContent 

            byte[] ssMessage = new byte[ssHead.Length + ssContent.Length]; 

 

            ssHead.CopyTo(ssMessage, 0); 

            ssContent.CopyTo(ssMessage, ssHead.Length);

 

            string sMessage = System.Text.Encoding.Unicode.GetString(ssMessage);

 

    Console.WriteLine(sMessage); 

    Console.ReadLine(); 

 

    //输出结果为:

 

    This is Head:This is Content.

你可能感兴趣的:(程序人生)