Partager via


HttpActionContextExtensions.GetValidators Method

Retrieves the collection of registered ModelValidator instances.

Namespace:  System.Web.Http.Controllers
Assembly:  System.Web.Http (in System.Web.Http.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function GetValidators ( _
    actionContext As HttpActionContext, _
    metadata As ModelMetadata _
) As IEnumerable(Of ModelValidator)
'Usage
Dim actionContext As HttpActionContext
Dim metadata As ModelMetadata
Dim returnValue As IEnumerable(Of ModelValidator)

returnValue = actionContext.GetValidators(metadata)
public static IEnumerable<ModelValidator> GetValidators(
    this HttpActionContext actionContext,
    ModelMetadata metadata
)
[ExtensionAttribute]
public:
static IEnumerable<ModelValidator^>^ GetValidators(
    HttpActionContext^ actionContext, 
    ModelMetadata^ metadata
)
static member GetValidators : 
        actionContext:HttpActionContext * 
        metadata:ModelMetadata -> IEnumerable<ModelValidator> 
public static function GetValidators(
    actionContext : HttpActionContext, 
    metadata : ModelMetadata
) : IEnumerable<ModelValidator>

Parameters

Return Value

Type: System.Collections.Generic.IEnumerable<ModelValidator>
A collection of registered ModelValidator instances.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HttpActionContext. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).

See Also

Reference

HttpActionContextExtensions Class

System.Web.Http.Controllers Namespace