Class XmlSerializationOutputFormatter
- Namespace
- Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml
- Assembly
- Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.dll
This class handles serialization of objects to XML using XmlFormatter.
public class XmlSerializationOutputFormatter : StreamOutputFormatter<XmlFormatter, XmlFormatterOptions>, IOutputFormatter, IApiResponseTypeMetadataProvider, IConfigurable<XmlFormatterOptions>
- Inheritance
-
XmlSerializationOutputFormatter
- Implements
- Inherited Members
- Extension Methods
Examples
The following example demonstrates how to construct an and inspect its supported media types and encodings.
using System;
using System.Linq;
using Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml;
using Cuemon.Xml.Serialization.Formatters;
namespace DocfxExamples;
public class XmlSerializationOutputFormatterExample
{
public void Demonstrate()
{
var options = new XmlFormatterOptions();
var formatter = new XmlSerializationOutputFormatter(options);
Console.WriteLine($"Supported media types: {string.Join(", ", formatter.SupportedMediaTypes)}");
Console.WriteLine($"Supported encodings: {string.Join(", ", formatter.SupportedEncodings.Select(e => e.WebName))}");
}
}
Constructors
XmlSerializationOutputFormatter(XmlFormatterOptions)
Initializes a new instance of the XmlSerializationOutputFormatter class.
public XmlSerializationOutputFormatter(XmlFormatterOptions options)
Parameters
optionsXmlFormatterOptionsThe XmlFormatterOptions which need to be configured.