title: Why can't I pull a ushort from a System.Object and then cast it as a uint? (C#)
body: <p>I'm manipulating the items in a list that's a <code>System.Management.ManagementObjectCollection</code>. Each of these items is a <code>System.Management.ManagementObject</code> which contains properties indexed by string. See:</p>
  
  <pre><code>foreach (ManagementObject queryObj in searcher.Get())
  {
      string osversion = (string)queryObj["Version"];
      string os = (string)queryObj["Name"];
      uint spmajor = (uint)queryObj["ServicePackMajorVersion"];
      uint spminor = (uint)queryObj["ServicePackMinorVersion"];
      ...
      ...
      ...
  }
  </code></pre>
  
  <p>Each "dictionary access" to <code>queryObj</code> returns a C# <code>object</code> which is in fact whatever the property is supposed to be -- I have to know their "real" type beforehand, and that's OK.</p>
  
  <p>Problem is, I get a <code>InvalidCastException</code> in the <code>uint</code> casts. I have to use the real type, which is <code>ushort</code>. Shouldn't a cast from <code>ushort</code> to <code>uint</code> be acceptable and obvious?</p>
  
  <p>In this case, I'll eventually convert the values to <code>string</code>, but what if I had to get them into <code>uint</code> or <code>int</code> or <code>long</code> variables?</p>