title: Cannot convert foreach to linq select
body: <p>I am trying to convert my foreach loop, as shown below into a Linq select statement</p>
  
  <pre><code>IEnumerable&lt;string&gt; tokensFromPlans = GetTokens();
  foreach (var token in tokensFromPlans)
  {
      DeleteFromQueue(token);
  }
  </code></pre>
  
  <p>The above works fine. </p>
  
  <p>I'm trying to convert it to Linq to learn about Linq. </p>
  
  <pre><code>tokensFromPlans.Select(token =&gt; DeleteFromQueue(token));
  </code></pre>
  
  <p>This fails with </p>
  
  <blockquote>
    <p>The type arguments for method … cannot be inferred from the usage</p>
  </blockquote>
  
  <p>I'm very lost here. My understand for the Linq is we perform a select statement on the variable <code>tokensFromPlans</code>, which essentially iterations through the collection.</p>
  
  <p>On each member in the collection, we call the function <code>DeleteFromQueue</code></p>
  
  <p>I can't understand what I'm getting wrong.</p>
  
  <p>I have read <a href="https://stackoverflow.com/questions/3917249/the-type-arguments-for-method-cannot-be-inferred-from-the-usage">The type arguments for method cannot be inferred from the usage</a> but I don't believe that is the issue as I'm not working with anything so complex.</p>