Vb.net Directory.enumerate包含Take和Where的文件
我有以下问题:Vb.net Directory.enumerate包含Take和Where的文件,vb.net,Vb.net,我有以下问题: For Each _file As String In Directory.EnumerateFiles(Quellpfad, "*.rdy").Take(500).Where(Function(item) item.Replace(Quellpfad, "").Length <= 11) 将每个_文件作为目录中的字符串。EnumerateFiles(Quellpfad,*.rdy”).Take(500)。Where(函数(项)item.Replace(Quellpfad
For Each _file As String In Directory.EnumerateFiles(Quellpfad, "*.rdy").Take(500).Where(Function(item) item.Replace(Quellpfad, "").Length <= 11)
将每个_文件作为目录中的字符串。EnumerateFiles(Quellpfad,*.rdy”).Take(500)。Where(函数(项)item.Replace(Quellpfad,”)。长度您需要重新排序语句,将Where
放在Take
之前:
For Each _file As String In Directory.EnumerateFiles(Quellpfad, "*.rdy").Where(Function(item) item.Replace(Quellpfad, "").Length <= 11).Take(500)
对于目录中作为字符串的每个_文件。EnumerateFiles(Quellpfad,*.rdy”).Where(Function(item)item.Replace(Quellpfad,”).Length您应该使用Take
last,因为您想首先应用过滤器,您还应该使用orPath.GetFileNameWithoutExtension
而不是字符串。Replace
:
Dim files = From file In Directory.EnumerateFiles(Quellpfad, "*.rdy")
Where Path.GetFileName(file).Length <= 11
Take 500
Dim files=来自目录.EnumerateFiles(Quellpfad,*.rdy)中的文件
Where Path.GetFileName(文件).Length很乐意帮助:)