serialize

R

RobcPettit

Hi, Im creating a chart. I've got my plot area. My data is in a collection,which I get from a metastock file and I can draw it on the plot area OK. What I cant work out is how to reference that line data at run time. What i mean is the actual line data as drawn rather than referencing the metastock file again. Id like to be able to access my collection at run time. So far I've been reading about serialization, is this the best way to go. I wantto access the data to do some calculations and re plot.
Regards Robert
 
A

Arne Vajhøj

Other than that, you have lots of choices for serialization. You could
write a custom format, either in binary or text (binary being preferable
for data that is handled only by software, text being preferable if you
would like it to be human-readable for some reason). A text format could
be as simple as a comma- or tab-delimited file, or an XML-based format.

You could also use one of .NET's built-in serialization techniques. These
work well, especially if you aren't too particular about the precise way
the data is written. You have choices, including binary formatted, plain
XML, or even SOAP.

Any of those should work fine for your needs. Choosing something specific
depends somewhat on your own preferences and technical needs, but that
choice is most likely less critical that one might think. You can waste a
lot of time trying to decide what is the _exact_ best format, when all you
really need is _some_ way to save and load the data. :)

My own tendency is to go with what is likely to need me to write the least
amount of new code. Usually this would be the built-in serialization for
.NET, but when dealing with an existing and unsupported format such as
MetaStock this could be that format instead. Even when not, customization
of the .NET serialization can sometimes be tricky and so some explicit
format might wind up faster to get written and simpler to understand.

If something is to be persisted for some time (months/years), then I
would argue for a text format over a binary format (except in the cases
where the binary format is well defined).

Changes to the data classes and existing binary serialized data can
become quite messy.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top