Class PathMatching

Support for matching file and directory paths against predefined lists.

Inheritance
System.Object
PathMatching
Implements
System.Collections.Generic.IEnumerable<System.String>
System.Collections.IEnumerable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public class PathMatching : IEnumerable<string>, IEnumerable

Constructors

PathMatching()

Declaration
public PathMatching()

Methods

AddPath(String)

Adds the path to the set of paths to match against.

Declaration
public void AddPath(string path)
Parameters
Type Name Description
System.String path

The path to add.

Remarks

If the path starts with a tilde ('~') it will be expanded to contain the actual application root.

The path is interpreted as a directory if it ends with a '/'. Adding a path such as "/abc/" will match against anything that starts with "/abc/", such as "/abc/def/ghi.html".

If the path does not end with a '/' it is interpreted as a file. Adding a file will only match against the exact path added.

Clear()

Clears this instance.

Declaration
public void Clear()
Remarks

Will remove all path entries that has been added by calling AddPath.

GetEnumerator()

Returns an enumerator that iterates through the collection of URL:s used for path matching.

Declaration
public IEnumerator<string> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<System.String>

A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection.

IsMatch(String)

Determines whether the specified path matches a previously added path.

Declaration
public bool IsMatch(string path)
Parameters
Type Name Description
System.String path

The path.

Returns
Type Description
System.Boolean

true if the specified path is match; otherwise, false.

Remarks

Will check against all added paths, both directories and files. The matching is case-insensitive.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods