Friday, 3 April 2015

C# XML Deserialize in to Object - xmlns='' was not expected


<root element xmlns=''> was not expected.
{" was not expected.} XML Deserialize in C#
XmlRootAttribute xRoot = new XmlRootAttribute();
xRoot.ElementName = "RootElementName";
xRoot.IsNullable = true;
XmlSerializer objSer = new XmlSerializer(typeof(Result), xRoot);
FileStream objF = new FileStream("C:\\a.xml", FileMode.Open);
Result varResult = (Result)serializer.Deserialize(objF);
view raw gistfile1.cs hosted with ❤ by GitHub