/src/LinFu.Reflection/DefaultDirectoryLister.cs

http://github.com/philiplaureano/LinFu · C# · 23 lines · 12 code · 1 blank · 10 comment · 0 complexity · fd25e467855c334dba132197c6b67c33 MD5 · raw file

  1. using System.Collections.Generic;
  2. using System.IO;
  3. namespace LinFu.Reflection
  4. {
  5. /// <summary>
  6. /// A class that lists the contents of a given directory.
  7. /// </summary>
  8. internal class DefaultDirectoryLister : IDirectoryListing
  9. {
  10. /// <summary>
  11. /// Returns a list of files that match the <paramref name="searchPattern" />
  12. /// from the given directory <paramref name="path" />.
  13. /// </summary>
  14. /// <param name="path">The target directory to search.</param>
  15. /// <param name="searchPattern">The search string to match against the names of the files in the <paramref name="path" />.</param>
  16. /// <returns>The list of files that match the <paramref name="path" /> and <paramref name="searchPattern" /></returns>
  17. public IEnumerable<string> GetFiles(string path, string searchPattern)
  18. {
  19. return Directory.GetFiles(path, searchPattern);
  20. }
  21. }
  22. }