JsonViewComponentResult Class¶
Summary¶
An [Microsoft.AspNet.Mvc.IViewComponentResult](Microsoft.AspNet.Mvc.IViewComponentResult.yml) which renders JSON text when executed.
Constructors¶
-
JsonViewComponentResult
(System.Object)¶ Initializes a new [Microsoft.AspNet.Mvc.JsonViewComponentResult](Microsoft.AspNet.Mvc.JsonViewComponentResult.yml).
Arguments: - value (System.Object) – The value to format as JSON text.
public JsonViewComponentResult(object value)
-
JsonViewComponentResult
(System.Object, JsonSerializerSettings) Initializes a new [Microsoft.AspNet.Mvc.JsonViewComponentResult](Microsoft.AspNet.Mvc.JsonViewComponentResult.yml).
Arguments: - value (System.Object) – The value to format as JSON text.
- serializerSettings (JsonSerializerSettings) – The @!:JsonSerializerSettings- to be used by the formatter.
public JsonViewComponentResult(object value, JsonSerializerSettings serializerSettings)
-
JsonViewComponentResult
(System.Object, Microsoft.AspNet.Mvc.JsonOutputFormatter) Initializes a new [Microsoft.AspNet.Mvc.JsonViewComponentResult](Microsoft.AspNet.Mvc.JsonViewComponentResult.yml).
Arguments: - value (System.Object) – The value to format as JSON text.
- formatter (Microsoft.AspNet.Mvc.JsonOutputFormatter) – The [Microsoft.AspNet.Mvc.JsonOutputFormatter](Microsoft.AspNet.Mvc.JsonOutputFormatter.yml) to use.
public JsonViewComponentResult(object value, JsonOutputFormatter formatter)
-
Methods¶
-
Execute
(Microsoft.AspNet.Mvc.ViewComponentContext)¶ Renders JSON text to the output.
Arguments: - context (Microsoft.AspNet.Mvc.ViewComponentContext) – The [Microsoft.AspNet.Mvc.ViewComponentContext](Microsoft.AspNet.Mvc.ViewComponentContext.yml).
public void Execute(ViewComponentContext context)
-
ExecuteAsync
(Microsoft.AspNet.Mvc.ViewComponentContext)¶ Renders JSON text to the output.
Arguments: - context (Microsoft.AspNet.Mvc.ViewComponentContext) – The [Microsoft.AspNet.Mvc.ViewComponentContext](Microsoft.AspNet.Mvc.ViewComponentContext.yml).
Return type: System.Threading.Tasks.Task
Returns: A completed [System.Threading.Tasks.Task]().
public Task ExecuteAsync(ViewComponentContext context)
-