getanesortnow
New Member
I have one question. I have found code for ordering xml nodes in windows phone 7 listbox:\[code\]using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("P*****.xml", FileMode.Open, isoStore)) { XDocument loadedCustomData = http://stackoverflow.com/questions/14425246/XDocument.Load(isoStream); var filteredData = from c in loadedCustomData.Descendants("person") orderby (string)c.Attribute("name") select new Person() { Name = c.Attribute("name").Value, Beneficiary = c.Attribute("beneficiary").Value, Price = c.Attribute("price").Value, Deadline = c.Attribute("deadline").Value, Index = c.Attribute("index").Value, Description = c.Attribute("description").Value, Status = c.Attribute("status").Value }; listBox.ItemsSource = filteredData; } }\[/code\]But it's only work for ordering like from A to Z. But what I should do to order data in reverse ( from Z to A name) ? I have found something like this:\[code\]var people = data.Elements("person").OrderBy(p => (string)p.Attribute("Age"));\[/code\]and changed it to :\[code\]var people = data.Elements("person").OrderBy(p <= (string)p.Attribute("Age"));\[/code\]but it has error:\[quote\] The type arguments for method 'System.Linq.Enumerable.OrderBy(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly. \[/quote\]So i think this method not make sense. Anyway, have you any idea for reverse XML ordering?