title: Why can't I enumerate X509Store.Certificates
body: <p>Consider the following code:      </p>
  
  <pre><code>using (X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine))
  {
      store.Open(OpenFlags.ReadOnly);
  
      foreach (var certificate in store.Certificates)
      {
          if (!string.IsNullOrWhiteSpace(certificate?.SubjectName?.Name) 
              &amp;&amp; certificate.SubjectName.Name.StartsWith("CN=*.mysite.com"))
          {
              return certificate;
          }
      }
  }
  </code></pre>
  
  <p>So I can clearly loop through the certificates, but why can't I enumerate them. Why does the following code throw compilation errors?</p>
  
  <pre><code>var cert = store.Certificates.FirstOrDefault(x =&gt;
      string.IsNullOrWhiteSpace(x?.SubjectName?.Name) &amp;&amp;
      x.SubjectName.Name.StartsWith("CN=*.mysite.com"));
  </code></pre>
  
  <blockquote>
    <p>Error CS1061  'X509Certificate2Collection' does not contain a definition for 'FirstOrDefault' and no accessible extension method 'FirstOrDefault' accepting a first argument of type 'X509Certificate2Collection' could be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>