在xml序列化中,如果可空类型具有空值,我想显示自闭空标记。下面是我的序列化代码。
var sw = new StreamWriter(new FileStream(path, FileMode.Create),
Encoding.UTF8);
XmlSerializer ser =
new XmlSerializer(typeof(Data));
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "");
ser.Serialize(sw, leadsOnlineUpload, ns);
sw.Close();