我有这样的字典
private readonly Dictionary<List<String>,List<string>> _optionsetlist=new Dictionary<List<string>, List<string>>();
像这样将列表添加到字典中
List<string> optionset = new List<string> { _someText, _noteText, _optionsetLanguage, _optionsetselected };
_optionsetlist.a(optionset,optionset);
我想使用 xdoucment 生成一个 xml
var document = new XDocument(
new XDeclaration("1.0", "utf8", "yes"),
new XElement("CheckItemDetail", new XAttribute("CheckItemTypeId", checkitem),
new XAttribute("ButtonTypeId", buttonitem),
new XElement("ToBechecked", _isSelected),
from node in selectedItemsByTypeId select new XElement("Applicabilty",node.TypeId),
from node in _selectedImageItem select new XElement("Images", node),
//here dictinoary list values should come in place
)
);
字典中的每个列表都包含 4 个值
样本输出
<CheckItemDetail CheckItemTypeId="C8C7D303-F9A0-4304-B865-9803034F4F4C" ButtonTypeId="25F6C9AA-5714-4646-944C-0C2325A74A88">
<ToBeChecked>Y</ToBeChecked>
<Applicability> 4,5,6 </Applicability>
<Images>DDDDDDDD-F8B0-4A99-B699-F574E62A5425.jpg</Images>
<DataDefinition>
<DisplayOptions>
<OptionSet Lang="GE" Default="true">
<Designation>Motorraumverschalung inkl. Gummilippen</Designation>
<Note>keine Beschädigungen </Note>
</OptionSet>
</DisplayOptions>
</DataDefinition>
</CheckItemDetail>
上面输出的这4个细节应该用字典填充
<OptionSet Lang="GE" Default="true">
<Designation>Motorraumverschalung inkl. Gummilippen</Designation>
<Note>keine Beschädigungen </Note>