My problem is the following, I have a csv with two lines separated at the end by ; and each word separated by , such that:
test.csv
gato,casa,http,antonio;
perro,abanico,https,libro;
Now I want to select the first row and put each name in variables, for example string cat = cat that comes from the csv only from the first row and then the same with the second I have tried with this code but it is only getting the letters:
c#
static void Main(string[] args)
{
int contador;
string datos;
var ruta = Directory.GetCurrentDirectory();
ruta = ruta + "/prueba.csv";
var lineas = File.ReadAllText(ruta);
Console.Write(lineas.Split(';'));
Console.ReadKey();
}
Having these test values:
I have modified the code to achieve what I understand you are looking to achieve with your program:
Example: