I met a Difficulty to sort a list item string containing numbers.
I wish I could automatically sort from smallest to largest.
Here is my code:
// Initialize an array to store the numbers
List<string> tab_num = new List<string>();
tab_num.Add("A.3.2.1");
tab_num.Add("A.3.3.1");
tab_num.Add("A.1.0.1");
tab_num.OrderByDescending(num => num).ToList();
Why my result is false ?…
[1] A.3.2.1
[2] A.3.3.1
[3] A.1.0.1
Expected Result:
[1] A.1.0.1
[2] A.3.2.1
[3] A.3.3.1
Thanks a lot
OrderByDescending means from bigger to lower.
Also you are not assigning your result after sorting.
try this: