[Solved] Cannot group strings correctly if use IEnumerable.GroupBy in C# [closed]
To really make sure it comes out as you want it, you could do it like that: var val = val1 .GroupBy(f => Path.GetFileNameWithoutExtension(f)) //group by filename .OrderBy(group => group.Key); //here’s the “Sort” foreach (var group in val) { var q = group.OrderByDescending(f => Path.GetExtension(f)); //order the filenames for outputting foreach (var f in q) … Read more