I have a problem using Linq to order a structure like this :
public class Person
{
public int ID { get; set; }
public List Attribu
This is assuming that Attribute class implement IComparable or has a nice ToString function (i hope).
var list = personList.OrderBy(p => p.Attributes.FirstOrDefault(a => a.Name == "Age"))
Otherwise the syntax gets more convoluted:
var list = personList
.OrderBy(p =>
p.Attributes.FirstOrDefault(a => a.Name == "Age") == null ?
"" : p.Attributes.First(a => a.Name == "Age").Value
);
I also assume that you have one value for each key - otherwise you'd need to have smarter code... ;-)