Microsoft KB Archive/839285

= Error message when you use the System.Management.ObjectGetOptions enumeration in Visual C# .NET or in Visual C# 2005: &quot;Argument '3': cannot convert from 'System.TimeSpan' to 'System.Management.ObjectGetOptions'&quot; =

Article ID: 839285

Article Last Modified on 12/11/2006

-

APPLIES TO


 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition
 * Microsoft Visual C# 2005 Express Edition

-





SYMPTOMS
When you use the System.Management.ObjectGetOptions enumeration in the ManagementClass class constructor in Microsoft Visual C# .NET and in Microsoft Visual C# 2005, you may receive the following compiler error message:

Argument '3': cannot convert from 'System.TimeSpan' to 'System.Management.ObjectGetOptions'



CAUSE
This issue occurs if the ManagementClass class constructor is passed to the System.Management.ObjectGetOptions.InfiniteTimeout field as a third parameter. The following code is an example: ManagementClass objClass = new ManagementClass(&quot;&quot;,&quot;&quot;,System.Management.ObjectGetOptions.INFINITE);



RESOLUTION
The ManagementClass class constructor is used as follows: ManagementClass objClass = new ManagementClass(&quot;&quot;,&quot;&quot;,new ObjectGetOptions); If you want an uninitialized ManagementClass object, use the default class contractor as follows: ManagementClass objClass = new ManagementClass;

Keywords: kbcompiler kbprb KB839285

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.