c# - Generate xml using Dictionary<List<String>,List<string>> -


i having dictonary this

  private readonly dictionary<list<string>,list<string>> _optionsetlist=new dictionary<list<string>, list<string>>(); 

adding list dictionary this

 list<string> optionset = new list<string> { _sometext, _notetext, _optionsetlanguage, _optionsetselected }; _optionsetlist.a(optionset,optionset); 

i want geneate xml using xdoucment

  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),                                             node in selecteditemsbytypeid select new xelement("applicabilty",node.typeid),                                             node in _selectedimageitem select new xelement("images", node),               //here dictinoary list values should come in place                                    )                       ); 

each list in dictionary consists of 4 values

sample output

    <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> 

this 4 details of above output should filled dictionaries

 <optionset lang="ge" default="true"> <designation>motorraumverschalung inkl. gummilippen</designation>    <note>keine beschädigungen </note> 


Comments