title: Splitting a string by a string and inserting into a list C#
body: <p>So I'm using C# and Visual Studio.  I am reading a file of students and their information.  The number of students is variable, but I want to grab their information.  At the moment I just want to segment the student's information based off of the string "Student ID" because each student's section starts with Student ID.  I'm using ReadAllText and setting it equal to a string and then feeding that string to my function splittingStrings.  The file will look like this:</p>
  
  <pre><code>student ID 1
  //bunch of info
  
  student ID 2 
  //bunch of info
  
  student ID 3 
  //bunch of info
  .
  .
  .
  </code></pre>
  
  <p>I'm wanting to split each segment into a list since the number of students will be unknown, and the information for each student will vary.  So I looked into both Regular string split and Regex string splitting.  For regular strings I tried this.  </p>
  
  <pre><code>        public static List&lt;string&gt; StartParse = new List&lt;string&gt;(); 
  
          public static void splittingStrings(string v)
          {
              string[] DiagDelimiters = new string[] {"Student ID "};
  
              StartParse.Add(v.Split(DiagDelimiters, StringSplitOptions.None);   
          }
  </code></pre>
  
  <p>And this is what I tried with Regex:</p>
  
  <pre><code>StartParse.Add(Regex.Split("Student ID ");
  </code></pre>
  
  <p>I haven't used Lists before, but from what I've read they are dynamic and easy to use.  My only trouble I'm getting is that all examples I see with split are in combination with an array so syntactically I'm not sure how to do a split on a string and insert it into a list.  For output my goal is to have the student segments divided so that if I need to I can call a particular segment later.</p>
  
  <hr>
  
  <p>Let me verify that I'm after that batch of information not the ID's alone.  A lot of the questions seem to be focused on that so I felt I needed to verify that.</p>
  
  <p>To those suggesting other storage bodies:</p>
  
  <p>example of what list will hold:</p>
  
  <pre><code>position 0 will hold [&lt;id&gt; //bunch of info] 
  position 1 will hold [&lt;anotherID&gt; //bunch of info]
  .
  .
  .
  </code></pre>
  
  <p>So I'm just using the List to do multiple operations on for information that I need.  The information will be FAR more manageable if I can segment them into the list as shown above.  I'm aware of dictionaries, but I have to store this information either in sql tables or inside text files depending on the contents of the segments.  An example would be if one segment was really funky then I would send an error report that one student's information is bad.  Otherwise insert neccessary information into sql table.  But I'm having to work with multiple things from the segments so I felt the List was the best way to go since I'll have to also go back and forth in the segment to cross check bits of information with earlier things in that segment I found.   </p>