I\'m in the process of making a small query thing for a set of results of files.
public class f_results
{
public String name { get; set; }
At least I suggest to remove the .ToList()
invokes everywhere. As LINQ has a deferred invocation, it will iterate once, even you have:
var foundfiles = from p in foundfiles where p.size >= sz select p ;
foundfiles = from p in foundfiles where p.mdate >= test select p
Update (in that case order by should be put after all filters)
But if you write:
var foundfiles = (from p in foundfiles where p.size >= sz orderby p.size descending select p).ToList() ;
foundfiles = (from p in foundfiles where p.mdate >= test select p).ToList();
It will iterate two times - and that might be a serious performance problem.
But I don't think the code will look much simpler if you make this code as a single query.
Also, why are you catching all exceptions? You shouldn't do that.