110,533
社区成员
发帖
与我相关
我的任务
分享
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
ByteArray aa = new ByteArray(new byte[50]);
ByteArray bb = new ByteArray(new byte[100]);
ByteArray cc = aa + bb;
byte[] xxoo = cc.getBytes();
for (int i = 0; i < xxoo.Length; i++)
{
Console.WriteLine(xxoo[i].ToString());
}
Console.ReadLine();
}
class ByteArray
{
private byte[] m_data = null;
public ByteArray(byte[] data)
{
m_data = data;
}
public byte[] getBytes()
{
return m_data;
}
static public ByteArray operator +(ByteArray a, ByteArray b)
{
byte[] xxoo1 = a.getBytes();
byte[] xxoo2 = b.getBytes();
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
ms.Write(xxoo1, 0, xxoo1.Length);
ms.Write(xxoo2, 0, xxoo2.Length);
return new ByteArray(ms.ToArray());
}
}
}
}