title: Linq performance for in-memory collection
body: <p>I have a list: Collection users which has around 100K+ records of users (all user objects fully loaded from the database with fields like Bio, First name, last name etc). This collection is fetched on application start from the database and is kept in memory.</p>
  
  <p>Then I have code like:</p>
  
  <pre><code>User cachedUser = users.FirstOrDefault(x =&gt; string.Equals(x.UserName, username,
  StringComparison.CurrentCultureIgnoreCase));
  </code></pre>
  
  <p>Which I use to fetch users from this collection. But somehow I noticed that this operation is incredibly slow. Is there a performance issue while using Linq to query in memory collection of large objects? Should I instead call the DB each time I want to get a user?</p>