Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is the function that I eventually used, it is a modified form of the one I posted in the link. It is odd, that there is no system function to do this.</p> <pre><code> /** * &lt;summary&gt; * This function converts a WMI CimType to a System.Type * It was copied from: http://www.devcow.com/blogs/adnrg/archive/2005/09/23/108.aspx * &lt;/summary&gt; */ private static System.Type ConvertCimType(PropertyData property) { System.Type tReturnVal = null; switch (property.Type ) { case CimType.Boolean: tReturnVal = typeof(System.Boolean); break; case CimType.Char16: tReturnVal = typeof(System.String); break; case CimType.DateTime: tReturnVal = typeof(System.DateTime); break; case CimType.Object: tReturnVal = typeof(System.Object); break; case CimType.Real32: tReturnVal = typeof(System.Decimal); break; case CimType.Real64: tReturnVal = typeof(System.Decimal); break; case CimType.Reference: tReturnVal = typeof(System.Object); break; case CimType.SInt16: tReturnVal = typeof(System.Int16); break; case CimType.SInt32: tReturnVal = typeof(System.Int32); break; case CimType.SInt8: tReturnVal = typeof(System.SByte); break; case CimType.String: tReturnVal = typeof(System.String); break; case CimType.UInt16: tReturnVal = typeof(System.UInt16); break; case CimType.UInt32: tReturnVal = typeof(System.UInt32); break; case CimType.UInt64: tReturnVal = typeof(System.UInt64); break; case CimType.UInt8: tReturnVal = typeof(System.Byte); break; } // do a final check tReturnVal = CheckType(property, tReturnVal); return tReturnVal; } private static System.Type CheckType(PropertyData property, System.Type itemType) { if (property.IsArray) { return System.Type.GetType( itemType.ToString() + "[]" ); } else { return itemType; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload