title: Verify the existence of a dictionary key
body: <p>I have this code snippet and I need to check the dictionary before accessing it.</p>
  <p>How can I verify the existence of the key before trying to access it ?</p>
  <pre><code>foreach (var publication in publications)
              {
                  var publicationLinks = links[publication.PublicationId];
  
                  var litigationLink = publicationLinks.FirstOrDefault(x =&gt; x.ProcessoId.HasValue);
                  if (litigationLink != null)
                  {
                      litigationLinks[publication.PublicationId] = litigationLink.ProcessoId.Value;
                      continue;
                  }
                  var contactLink = publicationLinks.FirstOrDefault(x =&gt; x.ContatoId.HasValue);
                  if (contactLink != null)
                  {
                      contactsLinks[publication.PublicationId] = contactLink.ContatoId.Value;
                  }
              }
  </code></pre>