c#怎样将 byte[] 加入到 object[]中

解决方案 »

  1.   

     byte[] _ValueByte = new byte[2];
               _ValueByte[0] = 1;
                _ValueByte[1] = 255;            object[] _ValueObject = new object[2];
                Array.Copy(_ValueByte, _ValueObject, 2);
    不知道是不是这个意思
      

  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];
      

  3.   

    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);
        }
      }
      

  4.   

     楼上CopyTo()函数用得不错
      

  5.   


                byte[] a = { 1, 2, 3, 4 };
                object[] b = new object[a.Length];
                Array.Copy(a, b, a.Length);
      

  6.   

    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;
        }     
        
      

  7.   

    byte[] a = { 1, 2, 3, 4 };
                object[] objects = new object[a.Length];
                a.CopyTo(objects, 0);