public bool Equals(Commune _commune) { if (_commune.NombreHabitant == nombreHabitant) { return(true); } else { return(false); } }
public static bool Equals(Commune commune1, Commune commune2) { if (commune1.NombreHabitant == commune2.NombreHabitant) { return(true); } else { return(false); } }
public void TrierCommunes() { bool faireLeTri = true; if (commune != null && commune.Length > 0) { for (int i = 0; (!faireLeTri) && i < commune.Length - 1; i++) { faireLeTri = false; if (Comparer(commune[i].Nom, commune[i + 1].Nom) == 2)//si une valeur du commune est supérieure à sa suivante, on les intervertie { Commune z = new Commune(commune[i].Nom, commune[i].Departement, commune[i].Pays, commune[i].Maire, commune[i].NombreHabitant); commune[i] = commune[i + 1]; commune[i + 1] = z; faireLeTri = true; } } } }