0
사전 필드가있는 클래스가 있습니다. 이 클래스의 모든 항목을 반복하고 XML 문서를 만들지 만이 루프 내부에서이 사전 속성을 반복하고 키 값 쌍을 추가하려고합니다.foreach inside xdocument.add
이미 다음
foreach(Book bk in query)
{
ReturnData.Descendants("Books")
.FirstOrDefault().Add(new XElement("Book",
new XElement("Name", bk.BookName),
new XElement("Measure", bk.Measure,
.foreach(KeyValuePair<string, double> measure in bk.NewMeasures)
{
new XElement(measure.Key,measure.Value)
},
new XElement("Value", bk.PreviousValue))));
}
반환 데이터를 할 것입니다 뭔가를 찾고 있어요 내가 책 후손에 추가하고 이유는, 일부 XML이 포함되어 있습니다. 그것은 이미 비디오, 게임 등 다른 뿌리가있을 수 있습니다.
이것에 대한 생각을 감사하십시오.
var book = ReturnData.Descendants("Books").FirstOrDefault();
을 그리고 루프 내에서 사용 : 모든
누구나 어떤 아이디어? – user1156000