Share via


OutputFormatterSelector.SelectFormatter Method

Definition

Selects an IOutputFormatter to write the response based on the provided values and the current request.

public:
 abstract Microsoft::AspNetCore::Mvc::Formatters::IOutputFormatter ^ SelectFormatter(Microsoft::AspNetCore::Mvc::Formatters::OutputFormatterCanWriteContext ^ context, System::Collections::Generic::IList<Microsoft::AspNetCore::Mvc::Formatters::IOutputFormatter ^> ^ formatters, Microsoft::AspNetCore::Mvc::Formatters::MediaTypeCollection ^ mediaTypes);
public abstract Microsoft.AspNetCore.Mvc.Formatters.IOutputFormatter SelectFormatter (Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterCanWriteContext context, System.Collections.Generic.IList<Microsoft.AspNetCore.Mvc.Formatters.IOutputFormatter> formatters, Microsoft.AspNetCore.Mvc.Formatters.MediaTypeCollection mediaTypes);
public abstract Microsoft.AspNetCore.Mvc.Formatters.IOutputFormatter? SelectFormatter (Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterCanWriteContext context, System.Collections.Generic.IList<Microsoft.AspNetCore.Mvc.Formatters.IOutputFormatter> formatters, Microsoft.AspNetCore.Mvc.Formatters.MediaTypeCollection mediaTypes);
abstract member SelectFormatter : Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterCanWriteContext * System.Collections.Generic.IList<Microsoft.AspNetCore.Mvc.Formatters.IOutputFormatter> * Microsoft.AspNetCore.Mvc.Formatters.MediaTypeCollection -> Microsoft.AspNetCore.Mvc.Formatters.IOutputFormatter
Public MustOverride Function SelectFormatter (context As OutputFormatterCanWriteContext, formatters As IList(Of IOutputFormatter), mediaTypes As MediaTypeCollection) As IOutputFormatter

Parameters

context
OutputFormatterCanWriteContext

The OutputFormatterCanWriteContext associated with the current request.

formatters
IList<IOutputFormatter>

A list of formatters to use; this acts as an override to OutputFormatters.

mediaTypes
MediaTypeCollection

A list of media types to use; this acts as an override to the Accept header.

Returns

The selected IOutputFormatter, or null if one could not be selected.

Applies to