序列化
zjj2816_163com
软硬通吃是目标
展开
-
自定义对象vs字符串
string objectTostring(object obj) { using (MemoryStream ms = new MemoryStream()) { XmlSerializer ss=new XmlSerializer(obj.GetType()); ss.Serialize(ms,we); return System.Text.Encoding.UTF8.原创 2005-08-05 13:30:00 · 822 阅读 · 0 评论 -
对象到。。。
byte[] ConvertObj2bytes(object obj) { using (MemoryStream ms = new MemoryStream()) { IFormatter formatter = new BinaryFormatter(); formatter.Serialize(ms, obj); return ms.GetBuffer();原创 2005-10-25 13:50:00 · 1088 阅读 · 0 评论