0

How to read .csv file extension in .net C#

AsifQadri
  • 2,388
  • 1
  • 20
  • 30
Nilanjan
  • 47
  • 2
  • Do you wish to read the file contents, or simply the file extension??? – Adriaan Stander Dec 22 '10 at 05:57
  • 2
    duplicates http://stackoverflow.com/questions/906841/csv-parser-reader-for-c & http://stackoverflow.com/questions/1375410/very-simple-c-csv-reader - please search before asking a question. And this question definitely doesn't deserve an upvote! – Kirk Broadhurst Dec 22 '10 at 06:03
  • possible duplicate of [Reading CSV files in .NET?](http://stackoverflow.com/questions/1405038/reading-csv-files-in-net) – Kirk Broadhurst Aug 12 '13 at 23:44

2 Answers2

3

I just write my own - it's a one-liner!

using System.IO.File;

return ReadAllLines(@"C:\V3.txt").Select(line => line.Split(',')).ToList();

This will return a list where each item is a string[], contain each of the comma separated values.

Kirk Broadhurst
  • 27,836
  • 16
  • 104
  • 169
0

FileHelper has mostly done the trick for me and it iss easy to use and has reasonable examples at the home page: http://www.filehelpers.com/

My Other Me
  • 5,007
  • 6
  • 41
  • 48