IComparer implementation when ordering by two parameters

30 Views Asked by At

I am trying to sort an IEnumerable<string> and return a list with the following C# code:

IEnumerable<string> dirs = null;

dirs = (from file in (dir.EnumerateFiles("*.*", so)
                         .Where(file => reSearchPattern.IsMatch(Path.GetExtension(file.Name))))
        orderby file.Directory ascending, file.LastWriteTime ascending  
        select file.FullName);

return dirs.ToList()

But I get an error

At least one object must implement IComparable

What do I do fix this?

0

There are 0 best solutions below