如题,我主要是想将如下的结构变量:
struct info
[
    DWORD a;
    unsigned long ckid;
}
转换成对应的字节数组,有没有什么好方法呀

解决方案 »

  1.   

    问题可不可以讲清楚一点?dword,unsigned long 不是C#的值类型。
      

  2.   

    struct info
    {
        int a;
        long ckid;
    }
      

  3.   

    struct info
    {
        int a;
        long ckid;
      byte[] ToBytes()
    {
    MemoryStream s = new MemoryStream();
    BinaryWriter w = new BinaryWriter(s);
    w.Write(a);
    w.Write(ckid);
    return s.ToArray();
    }
    }