2013-07-18 48 views
0

在我的项目中,我的文档名为:* .generated.cs。 我想将它们添加到列表中,但仅限于目录“Sample”或“BestSample”。 我有一个代码:罗斯林 - 搜索自定义路径中的所有文档

var files = from project in solution.Projects 
      from document in project.Documents 
      where document.FilePath == "Sample" || document.FilePath =="BestSample" 
      select document; 

但这不能正常工作;( 我怎样才能做到这一点

回答

1

文件路径是该文件的完整路径,所以你可能必须做一些什么样的? Path.GetDirectoryName(document.FilePath).EndsWith(“Sample”)等等。只需使用你的通常的字符串/路径操作API就可以了。