title: Should I check the Count of the collection before using foreach?
body: <p>Would there be any performance improvement to add a check of the count of a collection before enumerating the contents with foreach?</p>
  
  <pre><code>if (users.Count != 0) {
    foreach (var user in users) {
       // do what snowmen do in summer
    }
  }
  </code></pre>
  
  <p>vs.</p>
  
  <pre><code> foreach (var user in users) {
       // do what snowmen do in summer
    }
  </code></pre>
  
  <p>My function is taking a little too long, so I'd like to know if this will improve performance even a little to get my function execution time down to where I need it.</p>
  
  <p>Edit (context in which this loop executes):</p>
  
  <pre><code>for (DateTime day = dayStart; day &lt; dayEnd; day = day.addMinutes(30)) {
    // Other actions
    if (users.Count != 0) {
      foreach (var user in users) {
         // do what snowmen do in summer
      }
    }
  }
  </code></pre>