title: How to remove last two lines from list
body: <p>I'm trying to remove last two lines from list, with text document I did it this way:</p>
  
  <pre><code>var lines = System.IO.File.ReadAllLines(doc.txt); 
  System.IO.File.WriteAllLines(doc.txt, lines.Take(lines.Length - 2).ToArray());
  </code></pre>
  
  <p>but when I'm trying to do the same with list </p>
  
  <pre><code> List&lt;string&gt; myList = new List&lt;string&gt;();
  </code></pre>
  
  <p>this way, I have not result:</p>
  
  <pre><code>myList.RemoveAt(myList.Count - 2);
  </code></pre>