This comment on a stack overflow question suggests using a RestSharp XML serializer to serialize data to XML going out from ASP.NET Web API:
GlobalConfiguration.Configuration.Formatters.XmlFormatter = //RestSharp XML serializer here
What should be on the right-hand side of that expression?
I've also tried GlobalConfiguration.Configuration.Formatters.XmlFormatter.SetSerializer
, but 1) it requires a generic parameter, and I want it to work for everything, and 2) it cannot convert from 'RestSharp.Serializers.XmlSerializer' to 'System.Xml.Serialization.XmlSerializer'.
I'm trying to serialize to XML an object that has an IList as a parameter, and I understand that XML serializer that comes with ASP.NET cannot process this, so I figured I'd try the RestSharp serializer.
edit:
My class I want to serialize looks something like this:
public class Bar
{
}
public class Foo
{
public virtual IList<Bar> Bars { get; set; }
}
Thanks!