I am trying to seri开发者_如何学编程alize a List<MyObject>
. When I create my XmlSerializer as such:
XmlSerializer xmlSerializer = new XmlSerializer(List<MyObject>);
I get the following error: Ambiguous Constructor Reference
How can I fix this so I can serialize and deserialize my list?
XmlSerializer xmlSerializer = new XmlSerializer(typeof(List<MyObject>));
or
XmlSerializer xmlSerializer = new XmlSerializer(myList.GetType());
You are trying use this constructor, but you're not passing in a Type object.
精彩评论