Table of Contents

Class ModelBinderAttribute

Namespace
System.Web.Mvc
Assembly
System.Web.Mvc.dll

Represents an attribute that is used to associate a model type to a model-builder type.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface|AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public sealed class ModelBinderAttribute : CustomModelBinderAttribute
Inheritance
ModelBinderAttribute
Inherited Members

Constructors

ModelBinderAttribute(Type)

Initializes a new instance of the ModelBinderAttribute class.

public ModelBinderAttribute(Type binderType)

Parameters

binderType Type

The type of the binder.

Exceptions

ArgumentNullException

The binderType parameter is null.

Properties

BinderType

Gets or sets the type of the binder.

public Type BinderType { get; }

Property Value

Type

The type of the binder.

Methods

GetBinder()

Retrieves an instance of the model binder.

public override IModelBinder GetBinder()

Returns

IModelBinder

A reference to an object that implements the IModelBinder interface.

Exceptions

InvalidOperationException

An error occurred while an instance of the model binder was being created.