PropertyDataCollection Klasa

Definicja

Reprezentuje zestaw właściwości obiektu WMI.

public ref class PropertyDataCollection : System::Collections::ICollection
public class PropertyDataCollection : System.Collections.ICollection
type PropertyDataCollection = class
    interface ICollection
    interface IEnumerable
Public Class PropertyDataCollection
Implements ICollection
Dziedziczenie
PropertyDataCollection
Implementuje

Przykłady

W poniższym przykładzie wymieniono informacje o klasie Win32_OperatingSystem przy użyciu PropertyData klasy . Aby uzyskać więcej informacji na temat Win32_OperatingSystem, zobacz dokumentację instrumentacji zarządzania Windows .

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        ManagementClass osClass =
            new ManagementClass("Win32_OperatingSystem");

        osClass.Options.UseAmendedQualifiers = true;

        // Get the Properties in the class
        PropertyDataCollection properties =
            osClass.Properties;

        // display the Property names
        Console.WriteLine("Property Name: ");
        foreach (PropertyData property in properties)
        {
            Console.WriteLine(
                "---------------------------------------");
            Console.WriteLine(property.Name);
            Console.WriteLine("Description: " +
                property.Qualifiers["Description"].Value);
            Console.WriteLine();

            Console.WriteLine("Type: ");
            Console.WriteLine(property.Type);

            Console.WriteLine();

            Console.WriteLine("Qualifiers: ");
            foreach(QualifierData q in
                property.Qualifiers)
            {
                Console.WriteLine(q.Name);
            }
            Console.WriteLine();

            foreach (ManagementObject c in osClass.GetInstances())
            {
                Console.WriteLine("Value: ");
                Console.WriteLine(
                    c.Properties[property.Name.ToString()].Value);

                Console.WriteLine();
            }
        }
    }
}
Imports System.Management


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

        ' Get the WMI class
        Dim osClass As ManagementClass = _
            New ManagementClass("Win32_OperatingSystem")

        osClass.Options.UseAmendedQualifiers = True

        ' Get the Properties in the class
        Dim properties As PropertyDataCollection = _
            osClass.Properties

        ' display the Property names
        Console.WriteLine("Property Name: ")
        For Each p As PropertyData In properties

            Console.WriteLine( _
                "---------------------------------------")
            Console.WriteLine(p.Name)
            Console.WriteLine("Description: " & _
                p.Qualifiers("Description").Value)
            Console.WriteLine()

            Console.WriteLine("Type: ")
            Console.WriteLine(p.Type)

            Console.WriteLine()

            Console.WriteLine("Qualifiers: ")
            For Each q As QualifierData In _
                p.Qualifiers

                Console.WriteLine(q.Name)
            Next
            Console.WriteLine()

            For Each c As ManagementObject In osClass.GetInstances()

                Console.WriteLine("Value: ")
                Console.WriteLine( _
                    c.Properties(p.Name.ToString()).Value)

                Console.WriteLine()
            Next
        Next

    End Function
End Class

Właściwości

Count

Pobiera liczbę obiektów w obiekcie PropertyDataCollection.

IsSynchronized

Pobiera wartość wskazującą, czy obiekt jest zsynchronizowany.

Item[String]

Pobiera określoną właściwość z PropertyDataCollection, przy użyciu składni []. Ta właściwość jest indeksatorem PropertyDataCollection klasy .

SyncRoot

Pobiera obiekt, który ma być używany do synchronizacji.

Metody

Add(String, CimType, Boolean)

Dodaje nowy PropertyData bez przypisanej wartości.

Add(String, Object)

Dodaje nową PropertyData z określoną wartością. Wartość nie może być równa null i musi być konwertowana na typ modelu wspólnych informacji (CIM).

Add(String, Object, CimType)

Dodaje nowy PropertyData z określoną wartością i typem modelu wspólnych informacji (CIM).

CopyTo(Array, Int32)

Kopiuje element PropertyDataCollection do tablicy.

CopyTo(PropertyData[], Int32)

Kopiuje obiekt PropertyDataCollection do wyspecjalizowanej PropertyData tablicy obiektów.

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetEnumerator()

Zwraca moduł wyliczający dla tego PropertyDataCollectionelementu .

GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
Remove(String)

Usuwa element PropertyData z obiektu PropertyDataCollection.

ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

IEnumerable.GetEnumerator()

Zwraca wartość IEnumerator , która iteruje za pośrednictwem elementu PropertyDataCollection.

Metody rozszerzania

Cast<TResult>(IEnumerable)

Rzutuje elementy obiektu IEnumerable na określony typ.

OfType<TResult>(IEnumerable)

Filtruje elementy IEnumerable elementu na podstawie określonego typu.

AsParallel(IEnumerable)

Umożliwia równoległość zapytania.

AsQueryable(IEnumerable)

Konwertuje element IEnumerable na .IQueryable

Dotyczy