c# - Best way to store table like data -


what best way store table data

         | column 0 | column 1 | column 2 | column 3 | column 4 row 0    | 0.984546 | 0.654564 | 0.467676 | 0.673466 | 50.03333 row 1    | 0.684546 | 0.457564 | 0.467776 | 0.674566 | 45.73335 row 2    | 0.884546 | 0.424564 | 0.445676 | 0.664566 | 12.23333 row 3    | 0.284546 | 0.054564 | 0.237676 | 0.124566 | 45.01333 

both max column , row dynamic , coordinates of value important have calculation based on value. it's not database because data different every time , don't want forever there. also, need access. try use linked list double[] it's difficult me locate each of value. speed factor too.

any suggestion on type of collection should use or ways handle it?

i think should declare variable:

list< list<double> > matrix = new list< list<double> >(); 

later can use matrix.capacity decide number of rows , use same property on each row set number of columns. way wont have memory wasted.

you can use matrix.trimexcess() resize matrix if next data shorter.

the idea behind using matrix.capacity , matrix.trimexcess() have control of how space reserved in data structure. way wont grow , gain performance.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -