Partager via


GlobalFilterCollection Class

Represents a class that contains all the global filters.

Inheritance Hierarchy

System.Object
  System.Web.Mvc.GlobalFilterCollection

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Syntax

'Declaration
Public NotInheritable Class GlobalFilterCollection _
    Implements IEnumerable(Of Filter), IEnumerable,  _
    IFilterProvider
'Usage
Dim instance As GlobalFilterCollection
public sealed class GlobalFilterCollection : IEnumerable<Filter>, 
    IEnumerable, IFilterProvider
public ref class GlobalFilterCollection sealed : IEnumerable<Filter^>, 
    IEnumerable, IFilterProvider
public final class GlobalFilterCollection implements IEnumerable<Filter>, IEnumerable, IFilterProvider

The GlobalFilterCollection type exposes the following members.

Constructors

  Name Description
Public method GlobalFilterCollection Initializes a new instance of the GlobalFilterCollection class.

Top

Properties

  Name Description
Public property Count Gets the number of filters in the global filter collection.

Top

Methods

  Name Description
Public method Add(Object) Adds the specified filter to the global filter collection.
Public method Add(Object, Int32) Adds the specified filter to the global filter collection using the specified filter run order.
Public method Clear Removes all filters from the global filter collection.
Public method Contains Determines whether a filter is in the global filter collection.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetEnumerator Returns an enumerator that iterates through the global filter collection.
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method Remove Removes all the filters that match the specified filter.
Public method ToString (Inherited from Object.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IEnumerable.GetEnumerator This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code.
Explicit interface implemetationPrivate method IFilterProvider.GetFilters This API supports the ASP.NET MVC infrastructure and is not intended to be used directly from your code.

Top

Remarks

Global filters run for every action of every controller. You can register a global filter using the Filters static registration endpoint.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Web.Mvc Namespace

Other Resources

Filtering in ASP.NET MVC