* formatters added note about order;change code * added space between sentencespull/4169/head
parent
fcd26bdbb2
commit
377d8cdcdd
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue