Comparer les elements dans une liste
Salut everyone,
J'ai une structure à sérialiser en une fichier XML :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| [XmlRoot("NXRoutes")]
public class NXRoutes
{
[XmlElement("NXRoute")]
public List<NXRoute> NXRoute { get; set; }
}
public class NXRoute
{
[XmlAttribute("ID")]
public string ID { get; set; }
[XmlAttribute("OriginSignal")]
public string OriginSignal { get; set; }
[XmlAttribute("DestinationSignal")]
public string DestinationSignal { get; set; }
[XmlElement("Path")]
public List<Path> Path { get; set; }
}
public class Path
{
[XmlAttribute("Nbr_R")]
public int R_count { get; set; }
[XmlAttribute("ID")]
public string ID { get; set; }
[XmlAttribute("Preferred")]
public string Preferred { get; set; }
[XmlAttribute("SnowPlan")]
public string SnowPlan { get; set; }
[XmlText]
public string PathInnerText { get; set; }
} |
j'ai une List<NXRoute> NXRouteList
chaque element NXRoute de ma liste contient à son tour une liste : List<Path>
chaque element Path contient un attribut de type entier appelé "R_Count"
Dans chaque "NXRoute" je souhaite comparer les elements de la liste "Path" entre eux en se basant sur la valeur de l'attribut "R_Count"
==> Par exemple pour le path qui a la plus petite valeur dans son attribut "R_Count" je ferais un calcul / et pour les autres je fairais un autre calcul
comment comparer donc ces path entre eux en se basant sur l'attribut "R_Count" le plus petit ?