I need to read text data from file, where there are different types of data in every line. So, I created a one big class named subject. My data looks something like this:
Subject name      M1   M2   M3   M4
Subject1           5    7    8    3
Old Subject        1    2    5    9
The main question is, if it is possible to read all the data in line 1 for instance and assign it to proper fields, like SubjName = Subject1, M1 = 5, M2 = 7, M3 = 8 and so on, WITHOUT using substrings? (something like stream >> Subject.SubjName; stream >> Subject.M1 = 5 and so on in C++).
Here's the code that I have.
internal void Read()
{
        TextReader tr = new StreamReader("Data.txt");
        string line;
        while ((line = tr.ReadLine()) != null)    //read till end of line
        {
            tr.ReadLine();    //Skips the first line
        }
Thanks in advance
EDIT: To clarify, I'd prefer that fields are delimited.