Reading large XML files

Have you ever had a task to read and deserialize a large XML file? Like 500 MB, that is impossible just to read to the end and parse. I’ve faced such problem having an XML that looks like the following:

<?xml version="1.0" encoding="UTF-8"?>
<record id="0" Text="Some text for record 0" />
<record id="1" Text="Some text for record 1" />
<record id="2" Text="Some text for record 2" />
<record id="3" Text="Some text for record 3" />
...
<record id="1000000" Text="Some text for record 1000000" />

Continue reading Reading large XML files

Polymorphic serialization using Newton Json.NET in HttpContent

Imagine a quite common client-server application where server exposes REST methods and client communicates using HTTP requests. Requests and responses are serialized in JSON format. There might be a problem if you try to send and receive a DTO that contains a collection of interfaces or abstract classes. I will talk about usage of Web API and Newton Json.NET as it’s underlying serialization library.

Continue reading Polymorphic serialization using Newton Json.NET in HttpContent