title: Remove item from List and get the item simultaneously
body: <p>In C# I am trying to get an item from a list at a random index. When it has been retrieved I want it to be removed so that it can't be selected anymore. It seems as if I need a lot of operations to do this, isn't there a function where I can simply extract an item from the list? the RemoveAt(index) function is void. I would like one with a  return value.</p>
  
  <p>What I am doing:</p>
  
  <pre><code>List&lt;int&gt; numLst = new List&lt;int&gt;();
  numLst.Add(1);
  numLst.Add(2);
  
  do
  {
    int index = rand.Next(numLst.Count);
    int extracted = numLst[index]; 
    // do something with extracted value...
    numLst.removeAt(index);
  }
  while(numLst.Count &gt; 0);
  </code></pre>
  
  <p>What I would like to do:</p>
  
  <pre><code>List&lt;int&gt; numLst = new List&lt;int&gt;();
  numLst.Add(1);
  numLst.Add(2);
  
  do
  {
    int extracted = numLst.removeAndGetItem(rand.Next(numLst.Count)); 
    // do something with this value...
  }
  while(numLst.Count &gt; 0);
  </code></pre>
  
  <p>Does such a "removeAndGetItem" function exist? </p>