IComparer<KeyValuePair<float, int>> comp = Comparer<KeyValuePair<float, int>>.Create((a, b) => a.Key < b.Key ? 1 : 0);
List<KeyValuePair<float, int>> li = [
new(1f, 1),
new(1.5f, 2),
new(2.5f, 3),
new(0.5f, 4),
new(0.2f, 5)
];
li.Sort(comp);
foreach (var kvp in li)
Console.WriteLine(kvp.Key + ", " + kvp.Value);
IComparer<KeyValuePair<float, int>> comp = Comparer<KeyValuePair<float, int>>.Create((a, b) => a.Key < b.Key ? 1 : 0);
List<KeyValuePair<float, int>> li = [
new(1f, 1),
new(1.5f, 2),
new(2.5f, 3),
new(0.5f, 4),
new(0.2f, 5)
];
li.Sort(comp);
foreach (var kvp in li)
Console.WriteLine(kvp.Key + ", " + kvp.Value);