ManagementObject.Options 属性

定义

获取或设置检索对象时要使用的其他信息。Gets or sets additional information to use when retrieving the object.

public:
 property System::Management::ObjectGetOptions ^ Options { System::Management::ObjectGetOptions ^ get(); void set(System::Management::ObjectGetOptions ^ value); };
public System.Management.ObjectGetOptions Options { get; set; }
member this.Options : System.Management.ObjectGetOptions with get, set
Public Property Options As ObjectGetOptions

属性值

检索对象时要使用的 ObjectGetOptionsAn ObjectGetOptions to use when retrieving the object.

示例

下面的示例初始化 ManagementObject 类的新实例,然后更改 ManagementObject的默认选项。The following example initializes a new instance of the ManagementObject class and then change the default options for the ManagementObject.

using System;
using System.Management;
public class Sample 
{
    public static void Main() 
    {
        ///Contains default options
        ManagementObject o = 
            new ManagementObject("Win32_Process.Name='notepad.exe'"); 

        // Replace default options, 
        // in this case requesting retrieval of
        // amended qualifiers along with the WMI object.
        o.Options = new ObjectGetOptions(
            null, System.TimeSpan.MaxValue, true);
    }
}
Imports System.Management
Public Class Sample

    Public Overloads Shared Function Main( _
    ByVal args() As String) As Integer

        'Contains default options
        Dim o As New ManagementObject( _
            "Win32_Process.Name=""notepad.exe""")

        ' Replace default options, 
        ' in this case requesting retrieval of
        ' amended qualifiers along with the WMI object.
        o.Options = New ObjectGetOptions( _
            Nothing, System.TimeSpan.MaxValue, True)

        Return 0
    End Function
End Class

注解

如果在管理对象绑定到 WMI 对象之后更改了属性,则管理对象将从原始 WMI 对象断开连接,并在以后使用新选项重新绑定。When the property is changed after the management object has been bound to a WMI object, the management object is disconnected from the original WMI object and later rebound using the new options.

.NET Framework 安全性.NET Framework Security

对直接调用方的完全信任。Full trust for the immediate caller. 此成员不能由部分信任的代码使用。This member cannot be used by partially trusted code. 有关详细信息,请参阅从部分受信任的代码使用库For more information, see Using Libraries from Partially Trusted Code.

适用于