PropertyDataCollection Třída
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Představuje sadu vlastností objektu 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
- Dědičnost
-
PropertyDataCollection
- Implementuje
Příklady
Následující příklad uvádí informace o Win32_OperatingSystem třídy používající PropertyData třídu. Další informace o Win32_OperatingSystem najdete v dokumentaci Windows Management Instrumentation.
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
Vlastnosti
| Name | Description |
|---|---|
| Count |
Získá počet objektů v objektu PropertyDataCollection. |
| IsSynchronized |
Získá hodnotu určující, zda objekt je synchronizován. |
| Item[String] |
Získá zadanou vlastnost ze PropertyDataCollectionsyntaxe [] pomocí syntaxe []. Tato vlastnost je indexer pro PropertyDataCollection třídu. |
| SyncRoot |
Získá objekt, který se má použít pro synchronizaci. |
Metody
| Name | Description |
|---|---|
| Add(String, CimType, Boolean) |
Přidá novou PropertyData bez přiřazené hodnoty. |
| Add(String, Object, CimType) |
Přidá novou PropertyData s zadanou hodnotou a typem CIM (Common Information Model). |
| Add(String, Object) |
Přidá novou PropertyData se zadanou hodnotou. Hodnota nemůže být null a musí být konvertibilní na typ MODELU CIM (Common Information Model). |
| CopyTo(Array, Int32) |
Zkopíruje ho PropertyDataCollection do pole. |
| CopyTo(PropertyData[], Int32) |
Zkopíruje pole PropertyDataCollection specializovaného PropertyData objektu. |
| Equals(Object) |
Určuje, zda je zadaný objekt roven aktuálnímu objektu. (Zděděno od Object) |
| GetEnumerator() |
Vrátí enumerátor pro tento PropertyDataCollection. |
| GetHashCode() |
Slouží jako výchozí funkce hash. (Zděděno od Object) |
| GetType() |
Získá Type aktuální instance. (Zděděno od Object) |
| MemberwiseClone() |
Vytvoří mělkou kopii aktuálního Object. (Zděděno od Object) |
| Remove(String) |
Odebere z PropertyDataPropertyDataCollection . |
| ToString() |
Vrátí řetězec, který představuje aktuální objekt. (Zděděno od Object) |
Explicitní implementace rozhraní
| Name | Description |
|---|---|
| IEnumerable.GetEnumerator() |
IEnumerator Vrátí iteruje přes PropertyDataCollection. |
Metody rozšíření
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
Umožňuje paralelizaci dotazu. |
| AsQueryable(IEnumerable) |
Převede IEnumerable na IQueryable. |
| Cast<TResult>(IEnumerable) |
Přetypuje prvky IEnumerable na zadaný typ. |
| OfType<TResult>(IEnumerable) |
Filtruje prvky IEnumerable na základě zadaného typu. |