title: Testing for null reference in F#
body: <p>Given the following:</p>
  
  <pre><code>[&lt;DataContract&gt;]
  type TweetUser = {
      [&lt;field:DataMember(Name="followers_count")&gt;] Followers:int
      [&lt;field:DataMember(Name="screen_name")&gt;] Name:string
      [&lt;field:DataMember(Name="id_str")&gt;] Id:int
      [&lt;field:DataMember(Name="location")&gt;] Location:string}
  
  [&lt;DataContract&gt;]
  type Tweet = {
      [&lt;field:DataMember(Name="id_str")&gt;] Id:string
      [&lt;field:DataMember(Name="text")&gt;] Text:string
      [&lt;field:DataMember(Name="retweeted")&gt;] IsRetweeted:bool
      [&lt;field:DataMember(Name="created_at")&gt;] DateStr:string
      [&lt;field:DataMember(Name="user", IsRequired=false)&gt;] User:TweetUser
      [&lt;field:DataMember(Name="sender", IsRequired=false)&gt;] Sender:TweetUser
      [&lt;field:DataMember(Name="source")&gt;] Source:string}
  </code></pre>
  
  <p>Deserializing with <code>DataContractJsonSerializer(typeof&lt;Tweet[]&gt;)</code> will result in either the User or Sender field being null (at least that's what the debugger is telling me).</p>
  
  <p>If I try to write the following:</p>
  
  <pre><code>    let name = if tweet.User &lt;&gt; null 
                    then tweet.User.Name
                    else tweet.Sender.Name
  </code></pre>
  
  <p>the compiler emits the error: "The type 'TweetUser' does not have 'null' as a proper value"</p>
  
  <p>How do I test null values in this case?</p>