Skip to content

Instantly share code, notes, and snippets.

@Microsofttechies
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save Microsofttechies/15211be08573e256c47a to your computer and use it in GitHub Desktop.

Select an option

Save Microsofttechies/15211be08573e256c47a to your computer and use it in GitHub Desktop.
{"<RootElementName xmlns=''> 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment