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;

但这不起作用;(我该怎么做?

4

1 回答 1

1

FilePath 是文件的完整路径,因此您可能必须执行 Path.GetDirectoryName(document.FilePath).EndsWith("Sample") 之类的操作。只需在其上使用您常用的字符串/路径操作 API。

于 2013-07-19T05:23:46.973 回答