Suppose that I have a class that looks like below, how do I create xml like below using LINQ to XML?
public class Order
{
public string OrderNo {get; set;}
public string ItemId {get; set;}
public string ItemDesc {get; set;}
public int Qty {get; set;}
}
<orders>
<orderid>
<orderno>1</orderno>
<itemid>W001</itemid>
<itemdesc>C# T-Shirst</itemdesc>
<quantity>2</quantity>
</orderid>
<orderid>
<orderno>2</orderno>
<itemid>W002</itemid>
<itemdesc>XML T-Shirt</itemdesc>
<quantity>1</quantity>
</orderid>
</orders>