J'ai cet objet:Trier une liste d'objets contenant une liste chacun orderby
public class humanInfo
{
public string m_Name { get;set; }
public List<HumanAttributes> m_ListHumanAttributes { get; set;}
}
Je veux trier cette liste en fonction de l'attribut Age
qui est situé dans la liste des attributs pour chaque être humain.
humanList = humanList.OrderBy(/*How am I gonna do this?*/);
J'ai essayé d'atteindre tous les éléments à l'aide x => x.m_ListHumanAttributes.All()
, par exemple, mais je suis un peu désemparés quant à la façon dont je pourrais continuer. Quelqu'un a une bonne idée?
EDIT
Voici une idée comment la classe HumanAttributes
pourrait fonctionner:
public class HumanAttributes
{
public int m_HumanAttributesID {get;set;}
public Sex m_HumanAttributeSex {get;set;}
public int m_HumanAge {get;set;}
public decimal m_HumanHeight {get;set;}
}
pouvons-nous jeter un oeil à 'HumanAttributes '? –
Peut-être que 'x => x.Age'? – Tim