Loading a POCO from XML

  • Create the ReadXml Method
public OrderPoco ReadXml(string fileName)
{
    using (var sw = new StreamReader(fileName))
    {
        return (OrderPoco) new XmlSerializer(typeof(OrderPoco)).Deserialize(sw);
    }
} 
  • Using the ReadXml Method
void DemoReadXml()
{
    var o = ReadXml(@"c:\temp\orders.xml");
} 

Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com