views:

124

answers:

1

Hey everybody. I'm creating a catalog app where users add/download information on cars. This could result in hundreds, possibly thousands, of cars and their data (make, model, year, image etc...). Seeing as WP7 no database, I'm using XML. My question is, would it be efficient to store every object in a list, then serialize that entire list? When the user loads the app, the entire list is deserialized and every object is instantiated. Is there a better way of doing this? Thanks.

ps - I've come across DataContractSerializer, but not sure if I should use that since it seems to be WCF related (and I'm not using WCF in my app).

+1  A: 

Just do it and see. Unless every aspect of this is totally new to you, it should take less time to prototype and test something like this than it would take to have a discussion about it on SO - especially since the end result of the SO discussion will probably be someone telling you to prototype and test it.

If it's too slow, then you can look at alternatives - using a different kind of serialization method, partially deserializing the objects at startup to get the UI up and running and then continuing the deserialization in the background, or whatever.

Robert Rossney
thanks for replyig. I'll be working on the serialization tomorrow, but was hoping that someone may have some recommendations from experience on WP7. One thing, how would you partially deserialize objects if they're stored in a list? Is there some way of limiting it?
Brap
There are a lot of different ways. The crudest and simplest is to break your data up into a small piece and a large piece, deserialize the small piece, initialize the UI, and then deserialize the large piece on a background tread. Or you could implement an `XmlReader` subclass that parses the input stream and raises an event containing the XML of the last record it parsed every time it parses a complete record. Or...well, here I am trying to solve a problem without even knowing it exists.
Robert Rossney