File Search Library
SearchFiles Method
Example 



KellermanSoftware.FileSearchLibrary Namespace > FileSearchLogic Class : SearchFiles Method
Search parameters
Search for files
Syntax
'Declaration
 
Public Function SearchFiles( _
   ByVal searchParms As SearchParms _
) As List(Of String)
'Usage
 
Dim instance As FileSearchLogic
Dim searchParms As SearchParms
Dim value As List(Of String)
 
value = instance.SearchFiles(searchParms)
public List<string> SearchFiles( 
   SearchParms searchParms
)
public:
List<String^>^ SearchFiles( 
   SearchParms^ searchParms
) 

Parameters

searchParms
Search parameters
Example
//Setup the search parameters
SearchParms parms = new SearchParms();
 
//This is the directory to search
parms.DirectoriesToSearch.Add(@"c:\_git");
 
//Include all C# files by wildcard
parms.FilesToInclude.Add("*.cs");
parms.FileIncludeSearchType = FileSearchType.Wildcard;
 
//Search for a plain text phrase
parms.SearchString = "public partial class";
parms.SearchExpressionType = SearchExpressionType.PlainText;
 
//Search with the parameters
FileSearchLogic logic = new FileSearchLogic();
List<string> results = logic.SearchFiles(parms);
 
foreach (var filePath in results)
{
    Console.WriteLine(filePath);
}
'Setup the search parameters
Dim parms As New SearchParms()
 
'This is the directory to search
parms.DirectoriesToSearch.Add("c:\_git")
 
'Include all C# files by wildcard
parms.FilesToInclude.Add("*.cs")
parms.FileIncludeSearchType = FileSearchType.Wildcard
 
'Search for a plain text phrase
parms.SearchString = "public partial class"
parms.SearchExpressionType = SearchExpressionType.PlainText
 
'Search with the parameters
Dim logic As New FileSearchLogic()
Dim results As List(Of String) = logic.SearchFiles(parms)
 
For Each filePath In results
    Console.WriteLine(filePath)
Next filePath
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

FileSearchLogic Class
FileSearchLogic Members