@Waithley Williams , based on your code, I think you want to convert csv file to list.
You could try the following steps to solve the problem.
First, Please remove the reference related to LumenWorks.Framework.IO.Csv.
Second, Please install nuget-package CsvHelper.
Third, you could try the following code to get what you want.
using CsvHelper;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace Problem_for_csvreader
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
using (TextReader reader = new StreamReader("D:\\2.csv"))
using (var csvReader = new CsvReader(reader,CultureInfo.CurrentCulture,false))
{
var records = csvReader.GetRecords<Student>().ToList();
}
}
}
public class Student
{
public string Name { get; set; }
public int Age { get; set; }
public int ID { get; set; }
}
}
csv and result in winform:
Hope this could help you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.