public static void Main()
new { id="153_2" , order=1 },
new { id="153_3" , order=2 },
new { id="58_75" , order=1 },
new { id="58" , order=1 },
new { id="58_35" , order=3 },
new { id="153" , order=3 },
new { id="55_60" , order=2 },
new { id="55" , order=2 },
new { id="58_35" , order=1 },
.GroupBy(c => c.id.BeforeOrSame('_'))
.Select(g => g.OrderBy(d => d.id.Contains('_'))
.OrderBy(c => c.First().order)
foreach(var item in newList)
Console.WriteLine(item.id);
public static class Extensions
public static string BeforeOrSame(this string str, char c)
return i < 0 ? str : str.Substring(0, i);