DefaultOutputFormatterSelector.SelectFormatter 方法

定义

选择 , IOutputFormatter 以根据提供的值和当前请求写入响应。

public:
 override 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 ^ contentTypes);
public override 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 contentTypes);
public override 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 contentTypes);
override this.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 Overrides Function SelectFormatter (context As OutputFormatterCanWriteContext, formatters As IList(Of IOutputFormatter), contentTypes As MediaTypeCollection) As IOutputFormatter

参数

context
OutputFormatterCanWriteContext

OutputFormatterCanWriteContext 当前请求关联的 。

formatters
IList<IOutputFormatter>

要使用的格式化程序列表;这充当对 的 OutputFormatters替代。

contentTypes
MediaTypeCollection

返回

所选 IOutputFormatter的 ; null 如果无法选择,则为 。

适用于