diff --git a/aspnetcore/mvc/advanced/custom-formatters.md b/aspnetcore/mvc/advanced/custom-formatters.md index 1c98550c23..a67e8274fc 100644 --- a/aspnetcore/mvc/advanced/custom-formatters.md +++ b/aspnetcore/mvc/advanced/custom-formatters.md @@ -91,6 +91,8 @@ To use a custom formatter, add an instance of the formatter class to the `InputF [!code-csharp[Main](custom-formatters/sample/Startup.cs?name=mvcoptions&highlight=3-4)] +Formatters are evaluated in the order you insert them. The first one takes precedence. + ## Next steps See the [sample application](https://github.com/aspnet/Docs/tree/master/aspnetcore/mvc/advanced/custom-formatters/Sample), which implements simple vCard input and output formatters. The application reads and writes vCards that look like the following example: diff --git a/aspnetcore/mvc/advanced/custom-formatters/Sample/Startup.cs b/aspnetcore/mvc/advanced/custom-formatters/Sample/Startup.cs index d8bf05c605..0f9974af68 100644 --- a/aspnetcore/mvc/advanced/custom-formatters/Sample/Startup.cs +++ b/aspnetcore/mvc/advanced/custom-formatters/Sample/Startup.cs @@ -29,8 +29,8 @@ namespace CustomFormatterDemo #region mvcoptions services.AddMvc(options => { - options.InputFormatters.Add(new VcardInputFormatter()); - options.OutputFormatters.Add(new VcardOutputFormatter()); + options.InputFormatters.Insert(0, new VcardInputFormatter()); + options.OutputFormatters.Insert(0, new VcardInputFormatter()); }); #endregion