Serialization pros and cons
first time ever I did some examples of Serialization.
I am on the hook to write code that would read an excel file that has five fields.
Should I use the conventional way to read and write the data from the excel file or Seriable way ?
are there any disadv and advantages on way over the other?
thanks
nath
Re: Serialization pros and cons
What sort of Excel file is it? If its a CSV ten you don't need serialization. If its a normal excel file then serialization won't work unless you do it all manually.
Re: Serialization pros and cons
what is the advantage of using Serializable way?
the file is comma separated values file.
thanks
nath
Re: Serialization pros and cons
If you're reading a CSV file then you'd simply use a StreamReader or ADO.NET. I don't see an advantage to doing it any other way, although that doesn't mean that there isn't one.
Re: Serialization pros and cons
Jm,
the reason for my thought of using serialization is, after reading the content of the excel file (which has historical data of a stock), I would like to show that data in a chart (just like they show in yahoo finance).
does this requirement need the data to be read from CSV file in serialization format?
thanks
nath
Re: Serialization pros and cons
The point of serialisation is to convert an object into a form that can easily be sent over a serial connection, hence the name. If you want to create a chart then I don't see how that helps you. What you would want for a chart would be tabular data, so I would think that using ADO.NET to read the CSV into a DataTable would be the most effective in that case. If you prefer there would be less overhead (I think) using a StreamReader and you could still read the data into a DataTable or some other form, like a jagged or multidimensional array or some form of collection. I guess the advantage of ADO.NET is that more is done for you and you have the power of SQL to perform complex queries on the data if desired.
4 Attachment(s)
Re: Serialization pros and cons
I have written a stupid ExcelReader class and ExcelRow. You might want to look at it. Also attached is a unit test of my ExcelReader class.