title: Using a static variable to cache data
body: <p>We're developing a .NET 3.5 Windows Forms app, using LINQ to SQL and MVP. We have a DataRepository class for retrieving data:</p>
  
  <pre><code>public class DbUserRepository : IUserRepository 
  {
    private IList&lt;UserName&gt; _users;
  
    public IList&lt;UserName&gt; GetUserNames()
    {
      if (_users == null)
      {
        // retrieve _users from DB
      }
  
      return _users;
    }
  </code></pre>
  
  <p>In order to cache the list of users across all instances of the DBUserRepository, we were going to use the Enterprise Library's Caching Application Block.</p>
  
  <p>But it occured to me, couldn't I just make _users a static member? For some reason that seems like an "old school" way, but it works. Are there any downsides to doing this? Is this considered bad design?</p>
  
  <pre><code>private static IList&lt;UserName&gt; _users;
  </code></pre>
  
  <p>Thanks</p>