XmlSerializer to var object

107 views Asked by At

I am tring to use XmlSerializer with an anonymous type object

var obj = new { A=1, B="text" };
var serializer = new XmlSerializer(obj.GetType());

The Exception i am getting is: <>f__AnonymousType1`4[System.Int32,System.Int32,System.String,System.String] cannot be serialized because it does not have a parameterless constructor.

Is there a way to pass this?

0

There are 0 answers