Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
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²";
}
}
1
137
138
139
140
141
142
// {
foreach(var v in villeHabitants) {
Console.WriteLine($"{v.Key} - {v.Value}");
}
Enter to Rename, Shift+Enter to Preview
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