EnumerationOptions コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
EnumerationOptions クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| EnumerationOptions() |
既定値を使用して、 EnumerationOptions クラスの新しいインスタンスを初期化します (既定値については、個々のプロパティの説明を参照してください)。 これはパラメーターなしのコンストラクターです。 |
| EnumerationOptions(ManagementNamedValueCollection, TimeSpan, Int32, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean) |
クエリまたは列挙に使用する EnumerationOptions クラスの新しいインスタンスを初期化し、ユーザーがさまざまなオプションの値を指定できるようにします。 |
EnumerationOptions()
既定値を使用して、 EnumerationOptions クラスの新しいインスタンスを初期化します (既定値については、個々のプロパティの説明を参照してください)。 これはパラメーターなしのコンストラクターです。
public:
EnumerationOptions();
public EnumerationOptions();
Public Sub New ()
例
次の例では、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
注釈
.NET Framework のセキュリティ
直接呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されたコードでは使用できません。 詳細については、「 部分信頼コードからのライブラリの使用」を参照してください。
適用対象
EnumerationOptions(ManagementNamedValueCollection, TimeSpan, Int32, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)
クエリまたは列挙に使用する EnumerationOptions クラスの新しいインスタンスを初期化し、ユーザーがさまざまなオプションの値を指定できるようにします。
public:
EnumerationOptions(System::Management::ManagementNamedValueCollection ^ context, TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep);
public EnumerationOptions(System.Management.ManagementNamedValueCollection context, TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep);
new System.Management.EnumerationOptions : System.Management.ManagementNamedValueCollection * TimeSpan * int * bool * bool * bool * bool * bool * bool * bool -> System.Management.EnumerationOptions
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)
パラメーター
- context
- ManagementNamedValueCollection
プロバイダーに渡すことができるプロバイダー固有の情報を含む options コンテキスト オブジェクト。
- timeout
- TimeSpan
結果を列挙するためのタイムアウト値。
- blockSize
- Int32
WMI から一度に取得する項目の数。
- rewindable
- Boolean
true 結果セットが巻き戻し可能であることを示す (複数のトラバーサルを許可する)。それ以外の場合は false。
- returnImmediatley
- Boolean
true すべての結果が利用可能になるまで、操作が直ちに (準同期) またはブロックを返す必要があることを示す場合。それ以外の場合は false。
- useAmendedQualifiers
- Boolean
true 返されたオブジェクトに修正された (ロケールに対応する) 修飾子を含める必要があることを示す場合。それ以外の場合は false。
- ensureLocatable
- Boolean
true 返されるすべてのオブジェクトが有効なパスを持っていることを確認するには、それ以外の場合は false。
- prototypeOnly
- Boolean
true 実際の結果ではなく、結果セットのプロトタイプを返す場合。それ以外の場合は false。
- directRead
- Boolean
true 指定されたクラスのみのオブジェクトまたは派生クラスからオブジェクトを取得する場合。それ以外の場合は false。
- enumerateDeep
- Boolean
true サブクラスで再帰列挙型を使用する場合。それ以外の場合は false。
例
次の例では、EnumerationOptions コンストラクターを使用してEnumerationOptions変数を初期化し、WMI クラスとそのサブクラスのすべてのインスタンスを取得します。
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"]);
}
}
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
注釈
.NET Framework のセキュリティ
直接呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されたコードでは使用できません。 詳細については、「 部分信頼コードからのライブラリの使用」を参照してください。