byte[] _ValueByte = new byte[2]; _ValueByte[0] = 1; _ValueByte[1] = 255; object[] _ValueObject = new object[2]; Array.Copy(_ValueByte, _ValueObject, 2); 不知道是不是这个意思
byte[] bytes=new byte[5]{0,1,2,3,4}; object[] objs = new object[bytes.Length]; for (int i = 0; i < bytes.Length; i++) objs[i] = bytes[i];
class A { static void Main() { byte [] a = new byte[]{1,2,3,4}; object[] b = new object[a.Length]; a.CopyTo(b, 0); foreach (object o in b) { System.Console.WriteLine(o); } } }
楼上CopyTo()函数用得不错
byte[] a = { 1, 2, 3, 4 }; object[] b = new object[a.Length]; Array.Copy(a, b, a.Length);
up object[] b = new object[5]; byte [] a; for(int i=0;i<b.Length;i++) { a = new byte[]{1,2,3,4}; b[i]=a; }
byte[] a = { 1, 2, 3, 4 }; object[] objects = new object[a.Length]; a.CopyTo(objects, 0);
_ValueByte[0] = 1;
_ValueByte[1] = 255; object[] _ValueObject = new object[2];
Array.Copy(_ValueByte, _ValueObject, 2);
不知道是不是这个意思
byte[] bytes=new byte[5]{0,1,2,3,4};
object[] objs = new object[bytes.Length];
for (int i = 0; i < bytes.Length; i++)
objs[i] = bytes[i];
{
static void Main()
{
byte [] a = new byte[]{1,2,3,4};
object[] b = new object[a.Length];
a.CopyTo(b, 0);
foreach (object o in b)
{
System.Console.WriteLine(o);
}
}
}
byte[] a = { 1, 2, 3, 4 };
object[] b = new object[a.Length];
Array.Copy(a, b, a.Length);
byte [] a;
for(int i=0;i<b.Length;i++)
{
a = new byte[]{1,2,3,4};
b[i]=a;
}
object[] objects = new object[a.Length];
a.CopyTo(objects, 0);