title: Cleaner way to do a null check in C#?
body: <p>Suppose, I have this interface,</p>
  
  <pre><code>interface IContact
  {
      IAddress address { get; set; }
  }
  
  interface IAddress
  {
      string city { get; set; }
  }
  
  class Person : IPerson
  {
      public IContact contact { get; set; }
  }
  
  class test
  {
      private test()
      {
          var person = new Person();
          if (person.contact.address.city != null)
          {
              //this will never work if contact is itself null?
          }
      }
  }
  </code></pre>
  
  <p><code>Person.Contact.Address.City != null</code> (This works to check if City is null or not.)</p>
  
  <p>However, this check fails if Address or Contact or Person itself is null.</p>
  
  <p>Currently, one solution I could think of was this:</p>
  
  <pre><code>if (Person != null &amp;&amp; Person.Contact!=null &amp;&amp; Person.Contact.Address!= null &amp;&amp; Person.Contact.Address.City != null)
  
  { 
      // Do some stuff here..
  }
  </code></pre>
  
  <p>Is there a cleaner way of doing this?</p>
  
  <p>I really don't like the <code>null</code> check being done as <code>(something == null)</code>. Instead, is there another nice way to do something like the <code>something.IsNull()</code> method?</p>