Aracılığıyla paylaş


ManagementPath.IsClass Özellik

Tanım

Bunun bir sınıf yolu olup olmadığını belirten bir değer alır veya ayarlar.

public:
 property bool IsClass { bool get(); };
public bool IsClass { get; }
member this.IsClass : bool
Public ReadOnly Property IsClass As Boolean

Özellik Değeri

Bunun bir sınıf yolu olup olmadığını belirten bir Boolean değer döndürür.

Örnekler

Aşağıdaki örnek, sınıfın bir WMI nesnesinin ManagementPath yolunu nasıl ayrıştırduğunu gösterir. Örnekte ayrıştırılan yol, bir sınıfın örneğinin yoludur.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class path
        ManagementPath p =
            new ManagementPath(
            "\\\\ComputerName\\root" +
            "\\cimv2:Win32_LogicalDisk.DeviceID=\"C:\"");

        Console.WriteLine("IsClass: " +
            p.IsClass);
        // Should be False (because it is an instance)

        Console.WriteLine("IsInstance: " +
            p.IsInstance);
        // Should be True

        Console.WriteLine("ClassName: " +
            p.ClassName);
        // Should be "Win32_LogicalDisk"

        Console.WriteLine("NamespacePath: " +
            p.NamespacePath);
        // Should be "ComputerName\cimv2"

        Console.WriteLine("Server: " +
            p.Server);
        // Should be "ComputerName"

        Console.WriteLine("Path: " +
            p.Path);
        // Should be "ComputerName\root\cimv2:
        // Win32_LogicalDisk.DeviceId="C:""

        Console.WriteLine("RelativePath: " +
            p.RelativePath);
        // Should be "Win32_LogicalDisk.DeviceID="C:""
    }
}
Imports System.Management


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

        ' Get the WMI class path
        Dim p As ManagementPath = _
            New ManagementPath( _
            "\\ComputerName\root" & _
            "\cimv2:Win32_LogicalDisk.DeviceID=""C:""")

        Console.WriteLine("IsClass: " & _
            p.IsClass)
        ' Should be False (because it is an instance)

        Console.WriteLine("IsInstance: " & _
            p.IsInstance)
        ' Should be True

        Console.WriteLine("ClassName: " & _
            p.ClassName)
        ' Should be "Win32_LogicalDisk"

        Console.WriteLine("NamespacePath: " & _
            p.NamespacePath)
        ' Should be "ComputerName\cimv2"

        Console.WriteLine("Server: " & _
            p.Server)
        ' Should be "ComputerName"

        Console.WriteLine("Path: " & _
            p.Path)
        ' Should be "ComputerName\root\cimv2:
        ' Win32_LogicalDisk.DeviceId="C:""

        Console.WriteLine("RelativePath: " & _
            p.RelativePath)
        ' Should be "Win32_LogicalDisk.DeviceID="C:""

    End Function
End Class

Açıklamalar

Özellik Değeri

true bu bir sınıf yoluysa; aksi takdirde , false.

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

Şunlara uygulanır