Show / Hide Table of Contents

Method PathFilter.Filter


Overload

Filters a sequence of objects of any type that can provide a path (for example FileSystemInfo or string). Returns only objects whose paths match the glob patterns.

public IEnumerable<T> Filter<T>(IEnumerable<T> source, Func<T, string> getPath, string rootDir)
Parameters
source  (IEnumerable<T>)

The input.

getPath  (Func<T, string>)

A function that provides paths. Paths can be full (then use rootDir) or relative (rootDir null).

rootDir  (string)

The directory in which the enumeration is performed. The glob patterns are relative to this directory. Must be null if paths are relative.

Returns
IEnumerable<T>
Exceptions
ArgumentException

Some paths are not in rootDir.

Type Parameters
T