title: Problems using a string list inside of another list
body: <p>Basically what I am trying to do is to load a book text file into a string array, then to break the individual pages apart into separate pages along with other properties of each page in the book. When I try to add a new item into the list of pages it does not keep the dailypages.pageText value after I call temp.pageText.Clear(). I am very new to C# and object oriented programming so it's likely that I am doing more than one thing wrong here :)</p>
  
  
  
  <pre><code>abstract class Book
  {
    abstract internal void loadPages();
    protected string[] bookText { get; set; }  // Load entire book text into
    /// Other generic book properties
  
    public Book(string filename)  // Load the book
    {
      bookText = File.ReadAllLines(filename);
    }
  
    protected abstract class Page  // Generic page properties
    {
      internal int pageNum { get; set; }
      internal List&lt;string&gt; pageText{ get; set; }  // Single page from the book
  
      public Page()    // Init list of strings
      {
        pageText = new List&lt;string&gt;();
      }
    }
  }
  
  class DailyReflections : Book
  {
    List&lt;dailyPage&gt; dailypages = new List&lt;dailyPage&gt;();  // Init list of Pages
  
    override internal void loadPages()  // Split dailypages from bookText
    {
      DateTime date = new DateTime();
      DateTime date2 = new DateTime();
      dailyPage temp = new dailyPage();
  
      for (int bookline = 0; bookline &lt; bookText.LongLength; bookline++)
      {
        if (DateTime.TryParse(this.bookText[bookline], out date))
        {
          bookline++;
          while (!DateTime.TryParse(bookText[bookline], out date2))
          {
            temp.pageText.Add(bookText[bookline]);
            if (++bookline &gt;= bookText.LongLength) break;
          }
          bookline--;
        }
        temp.dailyDate = date;
        dailypages.Add(temp);
        temp.pageText.Clear();
        this.totalPages++;
      }
    Console.WriteLine(dailypages[0].pageText[0]); 
  //    ^^^ This line I get an out of range error, this should be line 1 of the 
  //    first page. Same error with any index used. If I take out the line
  //    temp.pageText.Clear(); (used to clear the text to fill it with the next
  //    page, maybe I am using it wrong). Without the .Clear() dailypages[0]
  //    contains page 1, [1] contains page 1 and page 2, [2] pages 1,2,3 since.
  //    it continues adding to the end of temp.pageText without clearing the 
  //    last page.
    }
  
    protected class dailyPage : Page  // Page with values unique to the book
    {
      internal DateTime dailyDate { get; set: }  // Date on the page
      internal string pageTitle { get; set; }  // Title of the page
    }
  }
  </code></pre>