Skip to content

NameQueryable

Julien Amsellem edited this page Sep 30, 2017 · 2 revisions

INameQueryable

If you want to search for files and/or folders based on their name you can use this interface which exposes the following methods:

  • Contains(string pattern): will match all files and folders that contain the pattern in the file name or directory name
  • StartWith(string pattern): will match all files and folders which name starts with the pattern
  • EndWith(string pattern): will match all files and folders which name ends with the pattern
  • Extension(string extension): will match all files with the specified extension (you must not add the '.')
  • Extensions(IEnumerable<string> extensions): Same as above but with several extensions

Samples

var everything = new Everything();
var results = everything.Search()
  .Name
  .Contains("img_");
var everything = new Everything();
var results = everything.Search()
  .Name
  .StartWith("copy");
var everything = new Everything();
var results = everything.Search()
  .Name
  .EndWith("_backup");
var everything = new Everything();
var results = everything.Search()
  .Name
  .Extension("bak");
var everything = new Everything();
var results = everything.Search()
  .Name
  .Extensions(new [] {"cs", "csproj", "xaml"});

<< Previous | Next >>

Clone this wiki locally