Udostępnij za pośrednictwem


OutputFormatterSelector.SelectFormatter Metoda

Definicja

Wybiera element IOutputFormatter , aby zapisać odpowiedź na podstawie podanych wartości i bieżącego żądania.

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

Parametry

context
OutputFormatterCanWriteContext

Element OutputFormatterCanWriteContext skojarzony z bieżącym żądaniem.

formatters
IList<IOutputFormatter>

Lista formaterów do użycia; to działa jako przesłonięcia do OutputFormatters.

mediaTypes
MediaTypeCollection

Lista typów multimediów do użycia; to działa jako zastąpienie nagłówka Accept .

Zwraca

Wybrany IOutputFormatterelement lub null , jeśli nie można go wybrać.

Dotyczy