【发布时间】:2011-10-09 21:48:39
【问题描述】:
我想序列化一个XDocument 对象。我写了这段代码。
XDocument signup_xml_file = new XDocument(
new XDeclaration("1.0", "utf-8", "yes"),
new XComment("signup_xml_file"),
new XElement("Student",
new XElement("univ_id", univ_id),
new XElement("personal_id",personal_id),
new XElement("user_name", user_name)));
client.Connect(host_name, port);
//connect to the server .
bf.Serialize(client.GetStream(), signup_xml_file); // serialize the signup_xml_file
尝试序列化XDocument 时出现以下异常。有什么方法可以使XDocument 类可序列化,还是有其他方法可以发送我的XDocument?
在程序集“System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”中的类型“System.Xml.Linq.XDocument”未标记为可序列化。
【问题讨论】:
标签: c# .net xml serialization