Ale na czym polega problem? Poza tym wypadałoby pokazać strukturę danych pliku. Po tym co napisałeś wynika, że poszczególne pola w pliku oddzielone są przecinkami, pasowałoby zatem uwzględnić to w kodzie (dlaczego parametr metody String.Split jest null). Swoją drogą mówisz, że musisz wczytać dane do listy a robisz to do aż 4. Poczytaj sobie o podejściu obiektowym.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace ConsoleApp1
{
class Person
{
public string Name { get; set; }
public string Surname { get; set; }
public int Age { get; set; }
public float Effectivity { get; set; }
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Podaj nazwe pliku do otwarcia: ");
string fileName = Console.ReadLine();
List<Person> people = new List<Person>();
String line;
StreamReader sr = new StreamReader(fileName);
while ((line = sr.ReadLine()) != null)
{
string[] s = line.Split(",");
var person = new Person
{
Name = s[0],
Surname = s[1],
Age = int.Parse(s[2]),
Effectivity = float.Parse(s[3], CultureInfo.InvariantCulture)
};
Console.WriteLine($"Imię: {person.Name}, Nazwisko: {person.Surname}, Wiek: {person.Age}, Skuteczność: {person.Effectivity}");
people.Add(person);
}
sr.Close();
Console.ReadKey();
}
}
}
Jan,Kowalski,25,40.50
Jacek,Nowak,18,56.78
Marta,Kwiatkowska,45,80
...