copymemory是哪里来的??
C#有位运算的啊!

解决方案 »

  1.   

    uint i = 5;
    byte [] b = new byte [4];
    b[0] = i>>24;
    i = i << 8;
    b[1] = i >> 24;
    i = i << 8;
    b[2] = i >> 24;
    i = i << 8;
    b[3] = i >> 24;给我加分呀!
      

  2.   

    使用 Buffer.Blockcopy()
    uint i=5;
    uint16[] u16=new uint16[1];
    u16[0]=5;
    byte[] b=new byte[4];
    Buffer.Blockcopy(u16,0,b,0,u16.lenght*2)public static void BlockCopy(
       Array src,
       int srcOffset,
       Array dst,
       int dstOffset,
       int count
    )
      

  3.   

    .NET中的类System.BitConverter专门用于基于位的类型转换: byte[] bs = System.BitConverter.GetBytes(myint16); //byte[2]
     byte[] bs = System.BitConverter.GetBytes(myint32); //byte[4]
     ...