QualifierDataCollection 类

定义

表示 QualifierData 对象集合。Represents a collection of QualifierData objects.

public ref class QualifierDataCollection : System::Collections::ICollection
public class QualifierDataCollection : System.Collections.ICollection
type QualifierDataCollection = class
    interface ICollection
    interface IEnumerable
Public Class QualifierDataCollection
Implements ICollection
继承
QualifierDataCollection
实现

示例

下面的示例使用QualifierData类列出有关Win32_Service类的限定符信息。The following example lists qualifier information about the Win32_Service class using the QualifierData class. 有关Win32_Service的详细信息, 请参阅Windows Management Instrumentation文档。For more information about Win32_Service, see the Windows Management Instrumentation documentation.

using System;
using System.Management;

public class Sample 
{    
    public static void Main() 
    {
        // Get the WMI class
        ManagementClass mClass = 
            new ManagementClass("Win32_Service");

        mClass.Options.UseAmendedQualifiers = true;

        // Get the Qualifiers for the class
        QualifierDataCollection qualifiers =
            mClass.Qualifiers;

        // display the Qualifier names
        Console.WriteLine(mClass.ClassPath.ClassName +
            " Qualifiers: ");
        foreach (QualifierData q in qualifiers)
        {
            Console.WriteLine(q.Name);
        }
        Console.WriteLine();
        
        Console.WriteLine("Class Description: ");
        Console.WriteLine(
            mClass.Qualifiers["Description"].Value);
    }
}
Imports System.Management


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

        ' Get the WMI class
        Dim mClass As ManagementClass = _
            New ManagementClass("Win32_Service")

        mClass.Options.UseAmendedQualifiers = True

        ' Get the Qualifiers for the class
        Dim qualifiers As QualifierDataCollection = _
            mClass.Qualifiers()

        ' display the Qualifier names
        Console.WriteLine(mClass.ClassPath.ClassName & _
            " Qualifiers: ")
        For Each q As QualifierData In qualifiers
            Console.WriteLine(q.Name)
        Next

        Console.WriteLine()

        Console.WriteLine("Class Description: ")
        Console.WriteLine( _
            mClass.Qualifiers("Description").Value)


    End Function
End Class

属性

Count

获取 QualifierData 中的 QualifierDataCollection 对象数。Gets the number of QualifierData objects in the QualifierDataCollection.

IsSynchronized

获取一个值,它指示该对象是否已同步(线程安全)。Gets a value indicating whether the object is synchronized (thread-safe).

Item[String]

QualifierData 中获取指定的 QualifierDataCollectionGets the specified QualifierData from the QualifierDataCollection.

SyncRoot

获取要用于同步的对象。Gets the object to be used for synchronization.

方法

Add(String, Object)

QualifierData 中添加一个 QualifierDataCollectionAdds a QualifierData to the QualifierDataCollection. 此重载指定限定符的名称和值。This overload specifies the qualifier name and value.

Add(String, Object, Boolean, Boolean, Boolean, Boolean)

QualifierData 中添加一个 QualifierDataCollectionAdds a QualifierData to the QualifierDataCollection. 此重载指定 QualifierData 的所有属性值。This overload specifies all property values for a QualifierData.

CopyTo(Array, Int32)

QualifierDataCollection 复制到一个数组中。Copies the QualifierDataCollection into an array.

CopyTo(QualifierData[], Int32)

QualifierDataCollection 复制到专用 QualifierData 数组中。Copies the QualifierDataCollection into a specialized QualifierData array.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetEnumerator()

返回 QualifierDataCollection 的一个枚举数。Returns an enumerator for the QualifierDataCollection. 此方法为强类型方法。This method is strongly typed.

GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Remove(String)

按名称从 QualifierData 移除 QualifierDataCollectionRemoves a QualifierData from the QualifierDataCollection by name.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

显式界面实现

IEnumerable.GetEnumerator()

返回循环访问 IEnumeratorQualifierDataCollectionReturns an IEnumerator that iterates through the QualifierDataCollection.

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于