C# XmlSerializer BindingFailure

前端 未结 4 1762
执念已碎
执念已碎 2020-12-08 06:29

I get a BindingFailure on a line of code using the XmlSerializer:

XmlSerializer s = new XmlSerializer(typeof(CustomXMLSerializeObject));
4条回答
  •  萌比男神i
    2020-12-08 07:01

    Use the following method to construct your xmlSerializer instance will fix the problem:

    XmlSerializer s = XmlSerializer.FromTypes(new[] { typeof(CustomXMLSerializeObject) })[0];
    

    then, you don't need to turn off the exception handlings.

提交回复
热议问题