2014-02-05 86 views
0

我使用XML元素 - 格式標記

new XElement("InstdAmt", "1000") 

不過,我想補充貨幣在第一個標籤,如下圖所示。我怎麼能這樣做?

僅在使用的第一個標籤

new XElement("InstdAmt Ccy=EUR", "1000") 

這樣我就可以得到這樣的結果

<InstdAmt Ccy="EUR">1000</InstdAmt> 

回答

1

只需添加一個屬性:

new XElement("InstdAmt", new XAttribute("Ccy", "Eur"), "1000");