title: Elegant way to avoid NullReferenceException in C#
body: <p>I want to do this</p>
  
  <pre><code>var path = HttpContext.Current.Request.ApplicationPath;
  </code></pre>
  
  <p>If any of the Properties along the way is null, i want path to be null, or "" would be better.</p>
  
  <p>Is there an elegant way to do this without Ternaries?</p>
  
  <p>ideally i would like this behavior (without the horrible performance and ugliness)
  string path;</p>
  
  <pre><code>try
  {
      path = HttpContext.Current.Request.ApplicationPath;
  }
  catch
  {
      path = null;
  }
  </code></pre>
  
  <p>Thank you</p>