title: Handling warning for possible multiple enumeration of IEnumerable
body: <p>In my code I need to use an <code>IEnumerable&lt;&gt;</code> several times, resulting in the ReSharper error of &quot;Possible multiple enumeration of <code>IEnumerable</code>&quot;.</p>
  <p>Sample code:</p>
  <pre><code>public List&lt;object&gt; Foo(IEnumerable&lt;object&gt; objects)
  {
      if (objects == null || !objects.Any())
          throw new ArgumentException();
          
      var firstObject = objects.First();
      var list = DoSomeThing(firstObject);        
      var secondList = DoSomeThingElse(objects);
      list.AddRange(secondList);
      
      return list;
  }
  </code></pre>
  <ul>
  <li>I can change the <code>objects</code> parameter to be <code>List</code> and then avoid the possible multiple enumeration but then I don't get the highest object that I can handle.</li>
  <li>Another thing that I can do is to convert the <code>IEnumerable</code> to <code>List</code> at the beginning of the method:</li>
  </ul>
  <hr />
  <pre><code> public List&lt;object&gt; Foo(IEnumerable&lt;object&gt; objects)
   {
      var objectList = objects.ToList();
      // ...
   }
  </code></pre>
  <p>But this is just <strong>awkward</strong>.</p>
  <p>What would you do in this scenario?</p>