<test>
<tool attr = "" sav="" >
<def sa="" tes=""/>
<def sa="" tes=""/>
Here the tool tag should be closed
<tool attr = "" sav="" >
<def sa="" tes=""/>
<def sa="" tes=""/>
</tool>
</tool> --> But its closing here
</test>
var ns = new XmlSerializerNamespaces();
ns.Add("", "");
var oSerialiser = new XmlSerializer(typeof(T));
var oStream = new FileStream(_filename, FileMode.Create);
oSerialiser.Serialize(oStream, this, ns);
oStream.Close();
如何使用c#代码在元素之后立即关闭结束标记而不使用xelement而是使用序列化器。
class tool
{
[XmlAttribute]
string attr;
[XmlAttribute]
string sav;
[XmlElement]
IList<string> def;
}