我有类Diag [使用xsd工具生成],我正在为此生成XML文件。
Diag diag = new Diag();
diag.DiagId = "1";
diag.Locked = false;
diag.Code = "C90.00";
diag.PrimSec = "+";
diag.IsTextStd = false;
diag.PdxGr = true;
diag.NotForGr = false;
diag.DiagTypeFlags = "$FHD;$ED;$BD";
diag.DeptNum = 0;
diag.ModType = "U";
diag.Amount=2800;
我得到的XML格式就像
我正在使用XmlSerializer
XmlSerializer mySerializer = new
XmlSerializer(typeof(Diag));
XmlWriter writer = XmlWriter.Create("myFileName.XML");
mySerializer.Serialize(writer, diag);
我不明白为什么没有在XML中生成非字符串值?