我想序列化我的查询。我做了:
MyDBViewDataContext db = new MyDBViewDataContext();
List<test_view> tvq = (from tt in db.test_views
select tt).ToList();
const string filename = "serial_file.xml";
XmlSerializer serializer = new XmlSerializer(typeof(test_view));
FileStream stream = new FileStream(filename,FileMode.Create);
serializer.Serialize(stream, tvq);
stream.Close();
但是有些错误,因为我收到了错误:
答案 0 :(得分:1)
更改您的行代码
XmlSerializer serializer = new XmlSerializer(typeof(test_view));
到
XmlSerializer serializer = new XmlSerializer(typeof(List<test_view>));