ManagementObject.ClassPath 属性

定义

获取或设置对象的类的路径。

public:
 virtual property System::Management::ManagementPath ^ ClassPath { System::Management::ManagementPath ^ get(); };
public override System.Management.ManagementPath ClassPath { get; }
member this.ClassPath : System.Management.ManagementPath
Public Overrides ReadOnly Property ClassPath As ManagementPath

属性值

一个 ManagementPath,它表示对象的类的路径。

示例

以下示例初始化 类的新实例, ManagementObject 然后检索 的类路径 ManagementObject

using System;
using System.Management;
public class Sample
{
    public static void Main()
    {
        ManagementObject o = new ManagementObject();

        // Specify the WMI path to which
        // this object should be bound to
        o.Path = new ManagementPath(
            "Win32_Process.Name='calc.exe'");
    }
}
Imports System.Management
Public Class Sample

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

        Dim o As New ManagementObject

        ' Specify the WMI path to which 
        ' this object should be bound to
        o.Path = New ManagementPath( _
            "Win32_Process.Name=""calc.exe""")

        Return 0
    End Function
End Class

注解

此属性为只读。

.NET Framework 安全性

对直接调用方的完全信任。 此成员不能由部分信任的代码使用。 有关详细信息,请参阅 使用部分受信任的代码中的库

适用于