IViewComponentHelper Interface

Supports the rendering of view components in a view.

Namespace
Microsoft.AspNetCore.Mvc
Assemblies
  • Microsoft.AspNetCore.Mvc.ViewFeatures

Syntax

public interface IViewComponentHelper
interface Microsoft.AspNetCore.Mvc.IViewComponentHelper

Methods

InvokeAsync(System.String, System.Object)

Invokes a view component with the specified <em>name</em>.

Arguments:
  • name (System.String) – The name of the view component.
  • arguments (System.Object) – An System.Object with properties representing arguments to be passed to the invoked view component method. Alternatively, an System.Collections.Generic.IDictionary`2 instance containing the invocation arguments.
Return type:

System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.IHtmlContent>

Returns:

A System.Threading.Tasks.Task that on completion returns the rendered Microsoft.AspNetCore.Html.IHtmlContent.

Task<IHtmlContent> InvokeAsync(string name, object arguments)
InvokeAsync(System.Type, System.Object)

Invokes a view component of type <em>componentType</em>.

Arguments:
  • componentType (System.Type) – The view component System.Type.
  • arguments (System.Object) – An System.Object with properties representing arguments to be passed to the invoked view component method. Alternatively, an System.Collections.Generic.IDictionary`2 instance containing the invocation arguments.
Return type:

System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.IHtmlContent>

Returns:

A System.Threading.Tasks.Task that on completion returns the rendered Microsoft.AspNetCore.Html.IHtmlContent.

Task<IHtmlContent> InvokeAsync(Type componentType, object arguments)