Error message when you use the System.Management.ObjectGetOptions enumeration in Visual C# .NET or in Visual C# 2005: "Argument '3': cannot convert from 'System.TimeSpan' to 'System.Management.ObjectGetOptions'" (839285)
The information in this article applies to:
- Microsoft Visual C# .NET (2003)
- Microsoft Visual C# .NET (2002)
- Microsoft Visual C# 2005, Express Edition
SYMPTOMSWhen 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' CAUSEThis 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("","",System.Management.ObjectGetOptions.INFINITE); RESOLUTIONThe ManagementClass class constructor is used as follows:
ManagementClass objClass = new ManagementClass("","",new ObjectGetOptions());
If you want an uninitialized ManagementClass object, use the default class contractor as follows:
ManagementClass objClass = new ManagementClass();
Modification Type: | Major | Last Reviewed: | 1/16/2006 |
---|
Keywords: | kbCompiler kbprb KB839285 kbAudDeveloper kbAudITPRO |
---|
|