当我输出这个代码时,当我只想要没有大括号的数字时,我得到{价格:1446}。有没有办法做到这一点?另外,一旦我得到价格值,我想将其转换为十进制。有没有办法做到这一点?LINQ删除大括号,铸造值
var flightPrice = (from f in XElement.Load(MapPath("flightdata.xml")).Elements("flight")
where (string)f.Element("flightnumber") == FlightNumber
&& (string)f.Element("destinationairportsymbol") == Destination
select new { Price = (Int32)f.Element("price") }
).SingleOrDefault();
lblPrice.Text = flightPrice.ToString();
你能告诉我们你解析XML文件? – 2011-05-14 23:34:15