Table of Contents

Class ViewEngineCollection

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

Represents a collection of view engines that are available to the application.

public class ViewEngineCollection : Collection<IViewEngine>, IList<IViewEngine>, ICollection<IViewEngine>, IList, ICollection, IReadOnlyList<IViewEngine>, IReadOnlyCollection<IViewEngine>, IEnumerable<IViewEngine>, IEnumerable
Inheritance
ViewEngineCollection
Implements
Inherited Members

Constructors

ViewEngineCollection()

Initializes a new instance of the ViewEngineCollection class.

public ViewEngineCollection()

ViewEngineCollection(IList<IViewEngine>)

Initializes a new instance of the ViewEngineCollection class using the specified list of view engines.

public ViewEngineCollection(IList<IViewEngine> list)

Parameters

list IList<IViewEngine>

The list that is wrapped by the new collection.

Exceptions

ArgumentNullException

list is null.

Methods

ClearItems()

Removes all elements from the Collection<T>.

protected override void ClearItems()

FindPartialView(ControllerContext, string)

Finds the specified partial view by using the specified controller context.

public virtual ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName)

Parameters

controllerContext ControllerContext

The controller context.

partialViewName string

The name of the partial view.

Returns

ViewEngineResult

The partial view.

Exceptions

ArgumentNullException

The controllerContext parameter is null.

ArgumentException

The partialViewName parameter is null or empty.

FindView(ControllerContext, string, string)

Finds the specified view by using the specified controller context and master view.

public virtual ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName)

Parameters

controllerContext ControllerContext

The controller context.

viewName string

The name of the view.

masterName string

The name of the master view.

Returns

ViewEngineResult

The view.

Exceptions

ArgumentNullException

The controllerContext parameter is null.

ArgumentException

The partialViewName parameter is null or empty.

InsertItem(int, IViewEngine)

Inserts an element into the collection at the specified index.

protected override void InsertItem(int index, IViewEngine item)

Parameters

index int

The zero-based index at which item should be inserted.

item IViewEngine

The object to insert.

Exceptions

ArgumentOutOfRangeException

index is less than zero.-or-index is greater than the number of items in the collection.

ArgumentNullException

The item parameter is null.

RemoveItem(int)

Removes the element at the specified index of the Collection<T>.

protected override void RemoveItem(int index)

Parameters

index int

The zero-based index of the element to remove.

Exceptions

ArgumentOutOfRangeException

index is less than zero.-or-index is equal to or greater than Count

SetItem(int, IViewEngine)

Replaces the element at the specified index.

protected override void SetItem(int index, IViewEngine item)

Parameters

index int

The zero-based index of the element to replace.

item IViewEngine

The new value for the element at the specified index.

Exceptions

ArgumentOutOfRangeException

index is less than zero.-or-index is greater than the number of items in the collection.

ArgumentNullException

The item parameter is null.