EnumerationOptions 類別

定義

為查詢和與列舉型別 (Enumeration) 相關的選項物件提供基底類別。

public ref class EnumerationOptions : System::Management::ManagementOptions
public class EnumerationOptions : System.Management.ManagementOptions
type EnumerationOptions = class
    inherit ManagementOptions
Public Class EnumerationOptions
Inherits ManagementOptions
繼承
EnumerationOptions

範例

下列範例會使用建 EnumerationOptions 構函式初始化 EnumerationOptions 變數,然後取得 WMI 類別及其子類別的所有實例。

using System;
using System.Management;
public class RemoteConnect
{
    public static void Main()
    {
        EnumerationOptions opt = new EnumerationOptions();
        // Will enumerate instances of the given class
        // and any subclasses.
        opt.EnumerateDeep = true;
        ManagementClass c = new ManagementClass("CIM_Service");
        foreach (ManagementObject o in c.GetInstances(opt))
            Console.WriteLine(o["Name"]);
    }
}
Imports System.Management
Public Class RemoteConnect

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

        Dim opt As New EnumerationOptions
        ' Will enumerate instances of the given class
        ' and any subclasses.
        opt.EnumerateDeep = True
        Dim mngmtClass As New ManagementClass("CIM_Service")
        Dim o As ManagementObject
        For Each o In mngmtClass.GetInstances(opt)
            Console.WriteLine(o("Name"))
        Next o

        Return 0
    End Function
End Class

建構函式

EnumerationOptions()

使用預設值,初始化 EnumerationOptions 類別的新執行個體 (關於預設值,請參閱個別屬性的描述)。 這是無參數建構函式。

EnumerationOptions(ManagementNamedValueCollection, TimeSpan, Int32, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)

初始化要用於查詢或列舉型別之 EnumerationOptions 類別的新執行個體,讓使用者為不同的選項指定數值。

屬性

BlockSize

取得或設定區塊操作的區塊大小。 經由集合列舉時,WMI 會以指定大小的群組傳回結果。

Context

取得或設定 WMI 內容物件。 這是名稱值配對清單,將要傳送至 WMI 提供者 (Provider),支援自訂作業的內容資訊。

(繼承來源 ManagementOptions)
DirectRead

取得或設定值,指出指定的類別是否需要「直接存取」WMI 提供者,而不需顧及其超級類別或衍生類別。

EnsureLocatable

取得或設定值,指出傳回的物件中是否應該含有可以找到的資訊。 這樣可以確保系統屬性 (例如 __PATH__RELPATH__SERVER) 不是 NULL。 這個旗標只能用於查詢,在列舉型別中會被忽略。

EnumerateDeep

取得或設定值,指出遞迴列舉型別是否應該進入衍生自指定 Superclass 的所有類別中。 如果為 false,就只會傳回立即衍生的類別成員。

PrototypeOnly

取得或設定值,指出查詢是否應該傳回結果集的原型,而不是實際的結果。 這個旗標用於原型處理。

ReturnImmediately

取得或設定值,指出叫用的作業是否應該以同步或半同步的方式執行。 如果這個屬性設定為 true,則會叫用 (Invoke) 列舉型別,且呼叫會立即傳回。 結果的實際擷取發生於產生的集合移位時。

Rewindable

取得或設定值,指出集合是否假設為可回轉。 如果為 true,集合中的物件會加以保留以便重複用於列舉型別中。 如果為 false,則集合只能被列舉一次。

Timeout

取得或設定套用至作業的逾時。 請注意,對於傳回集合的作業來說,這個逾時會經由產生的集合套用至列舉,而不是作業本身 (ReturnImmediately 屬性會為後者使用)。 這個屬性是用來指示作業應該半同步執行。

(繼承來源 ManagementOptions)
UseAmendedQualifiers

取得或設定值,指出從 WMI 傳回的物件是否應該包含修改的資訊。 一般來說,修改的資訊是附加至 WMI 物件的可當地語系化資訊,例如物件和屬性描述。

方法

Clone()

傳回物件的複本。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於