Sorting a List in C# using List.Sort(Comparison<T> comparison
.net, c#, list, sorting
Solution
You can use Linq OrderBy method for that -
sm = sm.OrderBy(i => i.num_of_words).ToList();
Problem
I have created a class as follows: ``` public class StringMatch { public int line_num; public int num_of_words; } ``` I have created a list ``` List<StringMatch> sm; ``` it has few elements in it. How do I sort this list using the `Comparison<T>` comparison overload? The sorting must be done based on the `num_of_words` field.