C#代码
//WorkSNBindDetailModel 实体// //MyGridSNBindContentList 数据源// XDocument document = XDocument.Load("..\\..\\Models/pro/WorkManager/ViewModel/SNBind.xml"); XElement root = document.Root; IEnumerable<XElement> enumerable = root.Elements(); foreach (XElement item in enumerable) { foreach (XElement item1 in item.Elements()) { WorkSNBindDetailModel workSNBind = WorkService.SelectSNBind(item1.Attribute("value").Value, SN); workSNBind.Name = item1.Attribute("value").Value; workSNBind.SN = SN; MyGridSNBindContentList.Add(workSNBind); } }XML文档
<?xml version="1.0" encoding="utf-8" ?> <Bind> <Item> <Name value="模块SN"></Name> </Item> <Item> <Name value="输出头SN"></Name> </Item> </Bind>