【发布时间】:2009-09-29 20:00:06
【问题描述】:
我需要一些帮助,使用 LINQ 根据文件大小来归档文件列表。我有一些代码,但它使用的是 file.length 而不是 FileInfo(file).length。我不知道如何在表达式中实现对象“FileInfo”。帮忙?
{
IEnumerable<string> result = "*.ini,*.log,*.txt"
.SelectMany(x => Directory.GetFiles("c:\logs", x, SearchOption.TopDirectoryOnly))
;
result = result
.Where(x => (x.Length) > "500000")
;
}
【问题讨论】: