EnumerationOptions.BlockSize 屬性

定義

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

public:
 property int BlockSize { int get(); void set(int value); };
public int BlockSize { get; set; }
member this.BlockSize : int with get, set
Public Property BlockSize As Integer

屬性值

區塊作業中的區塊大小。

範例

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

using System;
using System.Management;
public class RemoteConnect
{
    public static void Main()
    {
        EnumerationOptions opt = new EnumerationOptions();
        opt.BlockSize = 2;
        // 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
        opt.BlockSize = 2
        ' 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

備註

屬性值

預設值為 1。

.NET Framework 安全性

完全信任立即呼叫者。 這個成員無法供部分信任的程式碼使用。 如需詳細資訊,請參閱 使用部分信任程式代碼的連結庫

適用於