What is the best approach to keeping the 99% small amount of static data needed at startup?
I have a (small amount) of data for which I need quick access to the original load, but not after that.
Right now, I have serialized the data (shared list) into an Xml file and I will deserialize it on load as needed.
My question is, should I use XmlSerializer or BinaryFormatter? I'm not worried about the file size but the serialization speed.
a source to share
"We have to forget about little efficiency, say about 97% of the time: premature optimization is the root of all evil." - Don Knuth
If it's a small amount, go with the XmlSerializer, although it's definitely slower. This is one of those small performance indicators that are likely to be sworn in when someone tries to look at the file to diagnose a failure.
a source to share
Since John Saunders didn't suggest this, I suggest serializing your static data as code. As a weak nod for maintainability, you can have it in an external assembly. This should be the solution with the highest performance and lowest initial complexity.
If the data can be changed with any regularity or business logic, then ignore this answer. Not to be warned!
a source to share