Ordering list of strings that contains a combination of int and int with characters

Viewed 48

I need to Sort a List in c# that has data like

{"301","301b","301a","300",302}

Expected output

{"300","301","301a","301b",302}
1 Answers

Below one is your expected answer to make list in order.

List<string> abc=new List<string>() {"301","301b","301a","300","302"};
        
Console.WriteLine("Hello World {0}",string.Join("|",abc.OrderBy(x=>x).ToList()));

working example

Related