我想用Xelement創建一個xml文檔。我有一個2個對象,數據和產品的列表。每個都有一個對象列表。 xml文檔需要設置這樣如何使用Xelement創建一個xml文檔
<Property>
<Points>
<Sqft>1432</Sqft>
<Price>45666</Price>
<Product>Product Name</Product>
</Points>
</Property>
這裏是我使用的,當然這是行不通的代碼,但它是什麼,我會在理論上需要做的。
var xEleProperty = new XElement("Property",
from item in Property.Data && item1 in Property.Products
select new XElement("points",
new XElement("Sqft", item.sqft),
new XElement("Price", item.price),
new XElement("Product", item1.product)
));
ha!有趣的我只看到了編輯。我的輸出中有重複項!謝謝!!!! – texas697
太好了,很高興幫助 – BhavO