次の方法で共有


EnumerationOptions コンストラクタ (ManagementNamedValueCollection, TimeSpan, Int32, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)

さまざまなオプション値の指定を許可して、クエリまたは列挙に使用する EnumerationOptions クラスの新しいインスタンスを初期化します。

名前空間: System.Management
アセンブリ: System.Management (system.management.dll 内)

構文

'宣言
Public Sub New ( _
    context As ManagementNamedValueCollection, _
    timeout As TimeSpan, _
    blockSize As Integer, _
    rewindable As Boolean, _
    returnImmediatley As Boolean, _
    useAmendedQualifiers As Boolean, _
    ensureLocatable As Boolean, _
    prototypeOnly As Boolean, _
    directRead As Boolean, _
    enumerateDeep As Boolean _
)
'使用
Dim context As ManagementNamedValueCollection
Dim timeout As TimeSpan
Dim blockSize As Integer
Dim rewindable As Boolean
Dim returnImmediatley As Boolean
Dim useAmendedQualifiers As Boolean
Dim ensureLocatable As Boolean
Dim prototypeOnly As Boolean
Dim directRead As Boolean
Dim enumerateDeep As Boolean

Dim instance As New EnumerationOptions(context, timeout, blockSize, rewindable, returnImmediatley, useAmendedQualifiers, ensureLocatable, prototypeOnly, directRead, enumerateDeep)
public EnumerationOptions (
    ManagementNamedValueCollection context,
    TimeSpan timeout,
    int blockSize,
    bool rewindable,
    bool returnImmediatley,
    bool useAmendedQualifiers,
    bool ensureLocatable,
    bool prototypeOnly,
    bool directRead,
    bool enumerateDeep
)
public:
EnumerationOptions (
    ManagementNamedValueCollection^ context, 
    TimeSpan timeout, 
    int blockSize, 
    bool rewindable, 
    bool returnImmediatley, 
    bool useAmendedQualifiers, 
    bool ensureLocatable, 
    bool prototypeOnly, 
    bool directRead, 
    bool enumerateDeep
)
public EnumerationOptions (
    ManagementNamedValueCollection context, 
    TimeSpan timeout, 
    int blockSize, 
    boolean rewindable, 
    boolean returnImmediatley, 
    boolean useAmendedQualifiers, 
    boolean ensureLocatable, 
    boolean prototypeOnly, 
    boolean directRead, 
    boolean enumerateDeep
)
public function EnumerationOptions (
    context : ManagementNamedValueCollection, 
    timeout : TimeSpan, 
    blockSize : int, 
    rewindable : boolean, 
    returnImmediatley : boolean, 
    useAmendedQualifiers : boolean, 
    ensureLocatable : boolean, 
    prototypeOnly : boolean, 
    directRead : boolean, 
    enumerateDeep : boolean
)

パラメータ

  • context
    プロバイダに渡すことができるプロバイダ固有情報を格納しているオプション コンテキスト オブジェクト。
  • timeout
    結果を列挙するためのタイムアウト値。
  • blockSize
    WMI (Windows Management Instrumentation) から一度に取得する項目数。
  • rewindable
    結果セットを巻き戻すことができる (つまり、複数回の走査を許可する) かどうかを示すには true。それ以外の場合は false
  • returnImmediatley
    操作をすぐに返すか (半同期)、またはすべての結果が得られるまでブロックすることを示すには true。それ以外の場合は false
  • useAmendedQualifiers
    返されたオブジェクトが変更された (ロケール対応) 修飾子を格納していることを示すには true。それ以外の場合は false
  • ensureLocatable
    返されたすべてのオブジェクトのパスが有効であることを確認する場合は true。それ以外の場合は false
  • prototypeOnly
    実際の結果ではなく、結果セットのプロトタイプを返すには true。それ以外の場合は false
  • directRead
    指定したクラスだけのオブジェクトを取得するか、派生クラスからもオブジェクトを取得するには true。それ以外の場合は false
  • enumerateDeep
    サブクラスの再帰的な列挙を使用するには true。それ以外の場合は false

使用例

EnumerationOptions コンストラクタを使用して EnumerationOptions 変数を初期化し、WMI クラスおよびそのサブクラスのすべてのインスタンスを取得する例を次に示します。

Imports System
Imports System.Management
Public Class RemoteConnect

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

        Dim opt As EnumerationOptions
        Opt = New EnumerationOptions( _
            Nothing, System.TimeSpan.MaxValue, _
            1, True, True, False, _
            True, False, False, 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
using System;
using System.Management;
public class RemoteConnect 
{
    public static void Main() 
    {
        EnumerationOptions opt = new EnumerationOptions(
            null, System.TimeSpan.MaxValue,
            1, true, true, false, 
            true, false, false, true);

        ManagementClass c = new ManagementClass("CIM_Service");
        foreach (ManagementObject o in c.GetInstances(opt))
            Console.WriteLine(o["Name"]);
    }
}

.NET Framework のセキュリティ

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

プラットフォーム

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

EnumerationOptions クラス
EnumerationOptions メンバ
System.Management 名前空間