locked
Setting Row Headers In A CSV

Respuestas

  • No error checking here to ensure that each row actually contains the columns, but you get the idea:

       List<string[]> parsedData = new List<string[]>();
    
       using (StreamReader readfile = new StreamReader(path))
       {
        string line;
        string[] row;
    
        while ((line = readfile.ReadLine()) != null)
        {
         row = line.Split(',');
         parsedData.Add(new string[]{row[5], row[8]});
        }
       }

    Additionally, I would look for a better storage mechanism than a List of strings, perhaps a List of classes that would better describe the data.

    It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.


    martes, 13 de marzo de 2012 12:38

Todas las respuestas