title: Using the conditional operator ? to check for null session variable
body: <p>Take a look at this code:</p>
  
  <pre><code>System.Web.SessionState.HttpSessionState ss = HttpContext.Current.Session["pdfDocument"] ?? false;
  
          if ((Boolean)ss)
          {
              Label1.Text = (String)Session["docName"];
          }
  </code></pre>
  
  <p>Basically I want to check if HttpContext.Current.Session["pdfDocument"] is not null, and if it isn't to cast to Boolean, then check if its true or false.</p>
  
  <p>I'm trying to avoid nested if statements and figured there would be a more elegant way to do it.  I'm therefore only interested in answers that contain the conditional ? operator.</p>
  
  <p>Any tips?</p>