[Mono-list] Variable number of Lists depending on a CSV file

Ryan Boggs rmboggs at gmail.com
Sun Oct 9 12:38:38 EDT 2011


See inline comments below..

On Sun, Oct 9, 2011 at 9:21 AM, Paul F. Johnson
<paul at all-the-johnsons.co.uk> wrote:
> Hi,
> Is there a simple way to do this?
> What I'd like to do is read in a CSV file with each column being stored
> in it's own list. This is simple enough if I restrict the file to have a
> static number of column - I could have something like
> List <double> col1 = new List<double>();
> List <double> col2 = new List<double>();
> and so on.
> However, what I'd like to do is have a dynamic number of List objects
> depending on the number of columns.
This is the first thing that comes to mind, assuming every column in
the CSV file will be a double value.  However, I am not 100% sure if
this is the most efficient approach.

List<List<double>> rows = new List<List<double>>();

Here, you have a list within the list where the outer list would
represent each row in the CSV while the inner list would contain the
value of each column in the row of the CSV.

Hope this helps...


> Is this possible?
> Paul
> --
> Vertraue mir, ich weiss, was ich mache...
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

More information about the Mono-list mailing list