我有像这样的dictonary
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>