title: Get header value from Request avoiding invalid op exception
body: <p>I am trying to fetch value of header from a request using this code </p>
  
  <pre><code>var headervalue= Request.Headers.GetValues("name")?.FirstOrDefault();
  </code></pre>
  
  <p>i thought this would also take care of the null value returned, as this might cause that issue</p>
  
  <pre><code>var headervalue= Request.Headers.GetValues("name").FirstOrDefault();
  </code></pre>
  
  <p>reason, is i want to avoid handling exception in case there is no header of specified key. in both above cases I get InvalidOperation Exception if header key is not found.</p>
  
  <p>what is the best way to make this work without really having to handle invalidOp exception.</p>
  
  <p>Update:</p>
  
  <p>This particular syntax does not exist for me in my compiler</p>
  
  <p>Request.Headers["name"] . hence GetValues() looks like my only option, which just throws invalidop exception if header isnt found.</p>