ManagementBaseObject.ClassPath Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the path to the management object's class.
public:
virtual property System::Management::ManagementPath ^ ClassPath { System::Management::ManagementPath ^ get(); };
public virtual System.Management.ManagementPath ClassPath { get; }
member this.ClassPath : System.Management.ManagementPath
Public Overridable ReadOnly Property ClassPath As ManagementPath
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.
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);
}
}
}
Imports System.Management
Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Create a query for classes
Dim query As New SelectQuery( _
"SELECT * FROM meta_class")
' Initialize an object searcher with this query
Dim searcher As New ManagementObjectSearcher( _
query)
' Get the resulting collection and loop through it
For Each classObject As ManagementObject _
In searcher.Get()
Console.WriteLine( _
classObject.ClassPath)
Next
End Function
End Class
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.