Share via


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 のセキュリティ

直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「 部分信頼コードからのライブラリの使用」を参照してください。

適用対象