我在A程序里序列化一个类生成二进制文件代码如下:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter serializer =
new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();System.IO.MemoryStream memStream = new System.IO.MemoryStream();
serializer.Serialize(memStream, request);我可以直接在B程序中 不引用A程序集直接读取二进制文件
反序列化成和A程序中相同类结构的类对象么 ?请指教
new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();System.IO.MemoryStream memStream = new System.IO.MemoryStream();
serializer.Serialize(memStream, request);我可以直接在B程序中 不引用A程序集直接读取二进制文件
反序列化成和A程序中相同类结构的类对象么 ?请指教
把那个类写在一个dll里,A和B都可以用了
例如
WindowsApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null找 0x51 01 偏移3个字节 读出的数字是长度 根据长度获取
WindowsApplication4.Form1+TTZZZZZZZZZZZZZZZ 这里是类前的命名空间 中间是'+' 0x2B后面跟的是 对象的数量...按这个修改.然后保存回去..要注意的 先读出的长度也需要更改...
就是因为想减少文件大小, 缩短读取时间, 把复杂度降低才这样的
不过序列化成二进制文件却自动加入了程序集信息。 能不能在序列化的时候就控制住不加入这些不必要的信息呢 ?