Parsing .csv file into 2d array

后端 未结 5 1488
我寻月下人不归
我寻月下人不归 2021-02-08 01:20

I\'m trying to parse a CSV file into a 2D array in C#. I\'m having a very strange issue, here is my code:

string filePath = @\"C:\\Users\\Matt\\Desktop\\Eve Spre         


        
5条回答
  •  无人共我
    2021-02-08 02:26

    With Open File Dialog

    OpenFileDialog opn = new OpenFileDialog();
    
            if (opn.ShowDialog() == DialogResult.OK)
            {
               StreamReader sr = new StreamReader(opn.FileName);
    
               List data = new List(); 
    
               int Row = 0;
    
               while (!sr.EndOfStream)
               {
                   string[] Line = sr.ReadLine().Split(',');
                   data.Add(Line);
                   Row++;
                   Console.WriteLine(Row);
               }
    
    
            }
    

提交回复
热议问题