title: f# pattern matching with types
body: <p>I'm trying to recursively print out all an objects properties and sub-type properties etc.  My object model is as follows...</p>
  
  <pre><code>type suggestedFooWidget = {
      value: float ; 
      hasIncreasedSinceLastPeriod: bool ;
  }
  
  type firmIdentifier = {
      firmId: int ;
      firmName: string ;
  }
  type authorIdentifier = {
      authorId: int ;
      authorName: string ;
      firm: firmIdentifier ;
  }
  
  type denormalizedSuggestedFooWidgets = {
      id: int ; 
      ticker: string ;
      direction: string ;
      author: authorIdentifier ;
      totalAbsoluteWidget: suggestedFooWidget ;
      totalSectorWidget: suggestedFooWidget ;
      totalExchangeWidget: suggestedFooWidget ;
      todaysAbsoluteWidget: suggestedFooWidget ;
      msdAbsoluteWidget: suggestedFooWidget ;
      msdSectorWidget: suggestedFooWidget ;
      msdExchangeWidget: suggestedFooWidget ;
  }
  </code></pre>
  
  <p>And my recursion is based on the following pattern matching...</p>
  
  <pre><code>let rec printObj (o : obj) (sb : StringBuilder) (depth : int) 
      let props = o.GetType().GetProperties()
      let enumer = props.GetEnumerator()
      while enumer.MoveNext() do
          let currObj = (enumer.Current : obj)
          ignore &lt;|
               match currObj with
               | :? string as s -&gt; sb.Append(s.ToString())
               | :? bool as c -&gt; sb.Append(c.ToString())
               | :? int as i -&gt; sb.Append(i.ToString())
               | :? float as i -&gt; sb.Append(i.ToString())
               | _ -&gt;  printObj currObj sb (depth + 1)
      sb
  </code></pre>
  
  <p>In the debugger I see that currObj is of type string, int, float, etc but it always jumps to the defualt case at the bottom.  Any idea why this is happening?</p>