Exemple de tri

Meric
315 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Exemple de tri

Test : trier les ville par densite

Utiliser la classe :

class Ville 
{
    public Ville(string name, int nbHabitant, decimal surface, decimal densite)
    {
        NbHabitant = nbHabitant;
        Surface = surface;
        Name = name;
        Densite = densite;
    }

    public int NbHabitant { get; set; }
    public decimal Surface { get; set; }
    public string Name { get; set; }
    public decimal Densite { get; set; }

    public override string ToString()
    {
        return $"{Name} - Habitants: {NbHabitant}, Surface: {Surface} km²";
    }
}

Advanced usage

If you want a more complex example (external libraries, viewers...), use the Advanced C# template

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content