ManagementPath.RelativePath 속성 본문

[PL]/C# & WPF

ManagementPath.RelativePath 속성

객과 함께. 2010. 6. 26. 19:33

상대 경로, 즉 클래스 이름과 키만 가져오거나 설정합니다.

네임스페이스: System.Management
어셈블리: System.Management(system.management.dll)

 

속성 값
상대 경로를 포함하는 String 값을 반환합니다.
설명
--------------------------------------------------------------------------------

속성 값
이 개체에서 나타내는 상대 경로(서버 및 네임스페이스 부분 제외)가 포함된 문자열입니다.

.NET Framework 보안
직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분 신뢰 코드에서는 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

예제
--------------------------------------------------------------------------------

다음 예제에서는 ManagementPath 클래스가 WMI 개체에 대한 경로를 구문 분석하는 방법을 보여 줍니다. 예제에서 구문 분석된 경로는 클래스의 인스턴스에 대한 경로입니다.

C#

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:""

    }
}

 

출처 : MSDN

'[PL] > C# & WPF' 카테고리의 다른 글

[스크랩] VS2008로 작성한 C#프로젝트를 VS2005에서 열기  (0) 2010.07.08
csc 컴파일러 환경설정   (0) 2010.06.28
컨트롤 배열  (0) 2010.06.16
[펌글] VisualTreeHelper 클래스  (0) 2010.06.16
ListView Row Highlight  (0) 2010.06.04