日期:2014-05-18 浏览次数:21058 次
public bool Serialize<T>(T value, string filename)
{
try
{
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bs = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
System.IO.FileStream stream = new System.IO.FileStream(filename, System.IO.FileMode.Create);
bs.Serialize(stream, value);
stream.Close();
return true;
}
catch
{
return false;
}
}
------解决方案--------------------
为何不用Xml格式传输数据。
------解决方案--------------------
c#序列化的数据,c反序列化能识别吗?
我觉得通过json来传递数据会更加方便