I have wrote a WPF application that reads a list of movies from a XML file at a network location. When I started investigating the slow start-up it turned out that XmlSerializer has a lot overhead.
I have now used sgen to build the assemblies before I publish the project but I am now looking into a better solution. I have looked at the BinaryFormatter class but the XML file is created by a PHP script running on the Linux server.
Would I be better to use an XML file reader and loop through the file myself or is there a better option? I am aiming for speed so any suggestions to replace my XmlSerializer are welcome.
Here is the code for de-serializing the the file.
public List<Movie> DeSerializeXmlObject(string filename)
{
List<Movie> movies;
Stream stream = File.Open(filename, FileMode.Open);
XmlSerializer s = new XmlSerializer(typeof(List<Movie>));
movies = (List<Movie>)s.Deserialize(stream);
stream.Close();
return movies;
}
I couldn't figure out how to attach files so I pasted the XML file onto pastebin. http://pastebin.com/Rxsy0R3c Thanks Ben