Sorting a list of numbers using lambda expression

PHOTO EMBED

Sat Oct 16 2021 06:27:53 GMT+0000 (UTC)

Saved by @funcProgramming

var list = Enumerable.Range(1, 10).Select(i => i * 3).ToList();
list // => [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]
list.Sort((l, r) => l.ToString().CompareTo(r.ToString()));
list // => [12, 15, 18, 21, 24, 27, 3, 30, 6, 9]
content_copyCOPY