EnumerationOptions.BlockSize Propriedade

Definição

Obtém ou define o tamanho do bloco para operações de bloco.Gets or sets the block size for block operations. Ao enumerar por meio de uma coleção, o WMI retornará resultados em grupos do tamanho especificado.When enumerating through a collection, WMI will return results in groups of the specified size.

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

Valor da propriedade

Int32

O tamanho do bloco em operações de bloqueio.The block size in block operations.

Exemplos

O exemplo a seguir inicializa uma EnumerationOptions variável com um EnumerationOptions Construtor e, em seguida, obtém todas as instâncias de uma classe WMI e suas subclasses.The following example initializes an EnumerationOptions variable with an EnumerationOptions constructor and then gets all the instances of a WMI class and its subclasses.

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

Comentários

Valor da propriedadeProperty Value

O valor padrão é 1.The default value is 1.

Segurança do .NET Framework.NET Framework Security

Confiança total para o chamador imediato.Full trust for the immediate caller. Este membro não pode ser usado pelo código parcialmente confiável.This member cannot be used by partially trusted code. Para obter mais informações, consulte usando bibliotecas de código parcialmente confiável.For more information, see Using Libraries from Partially Trusted Code.

Aplica-se a