In this tutorial, I'll show you how to read a csv file in C#.NET

As you know, CSV is a file that contains data seperated by commas

For example



// path to the csv file
string path = "C://sample.csv";
string[] lines = System.IO.File.ReadAllLines(path);
foreach(string line in lines)
    string[] columns = line.Split(',');
    foreach (string column in columns) {
        //Process data

To read the csv file, you can use the ReadAllLines method to read each line is seperated by a comma, then split data with commas