Op Englesch liesen Editéieren

Deelen iwwer


ManagementBaseObject.ClassPath Property

Definition

Gets the path to the management object's class.

C#
public virtual System.Management.ManagementPath ClassPath { get; }

Property Value

The class path to the management object's class.

Examples

The following example code lists all the classes with their class paths in the root\CIMV2 namespace.

For the \MyBox\root\cimv2:Win32_LogicalDisk= 'C:' object, the class path is \MyBox\root\cimv2:Win32_LogicalDisk.

C#
using System;
using System.Management;

public class Sample
{
    public static void Main()
    {
        // Create a query for classes
        SelectQuery query =
            new SelectQuery("SELECT * FROM meta_class");

        // Initialize an object searcher with this query
        ManagementObjectSearcher searcher =
            new ManagementObjectSearcher(query);

        // Get the resulting collection and loop through it
        foreach (ManagementObject classObject in searcher.Get())
        {
            Console.WriteLine(
                classObject.ClassPath);
        }
    }
}

Remarks

Property Value

A ManagementPath that represents the path to the management object's class.

.NET Framework Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

Applies to

Produkt Versiounen
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)