wmcgee353
09-08-2010, 06:47 PM
Hello, I'm trying make a dictionary pairing from 3 things in an XML file. The first item and key of the dictionary is a string, the value is a decimal which will be the result of a price element times a quantity element. Here is my LINQ query thus far...
Dictionary total = (from myfile in file.Descendants("invoice")
let key = Convert.ToDecimal(myfile.Element("quantity").Value) * Convert.ToDecimal(myfile.Element("price").Value)
orderby Convert.ToDecimal(myfile.Element("quantity").Value) * Convert.ToDecimal(myfile.Element("price").Value)
select key).ToDictionary(file.Element("partDesc").Value);
Can anyone help me? I have googled this over and over, and I have not been able to find anything that demonstrates anything close to what I'm trying to do. Thanks for any help!
Dictionary total = (from myfile in file.Descendants("invoice")
let key = Convert.ToDecimal(myfile.Element("quantity").Value) * Convert.ToDecimal(myfile.Element("price").Value)
orderby Convert.ToDecimal(myfile.Element("quantity").Value) * Convert.ToDecimal(myfile.Element("price").Value)
select key).ToDictionary(file.Element("partDesc").Value);
Can anyone help me? I have googled this over and over, and I have not been able to find anything that demonstrates anything close to what I'm trying to do. Thanks for any help!