ManagementPath Construtores
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Inicializa uma nova instância da ManagementPath classe.
Sobrecargas
| Name | Description |
|---|---|
| ManagementPath() |
Inicializa uma nova instância da ManagementPath classe que está vazia. Este é o construtor sem parâmetros. |
| ManagementPath(String) |
Inicializa uma nova instância da ManagementPath classe para o caminho dado. |
ManagementPath()
- Origem:
- ManagementPath.cs
- Origem:
- ManagementPath.cs
- Origem:
- ManagementPath.cs
- Origem:
- ManagementPath.cs
Inicializa uma nova instância da ManagementPath classe que está vazia. Este é o construtor sem parâmetros.
public:
ManagementPath();
public ManagementPath();
Public Sub New ()
Observações
Segurança do .NET Framework
Confiança total no contacto imediato. Este membro não pode ser utilizado por código parcialmente confiável. Para mais informações, consulte Utilização de Bibliotecas de Código Parcialmente Confiável.
Aplica-se a
ManagementPath(String)
- Origem:
- ManagementPath.cs
- Origem:
- ManagementPath.cs
- Origem:
- ManagementPath.cs
- Origem:
- ManagementPath.cs
Inicializa uma nova instância da ManagementPath classe para o caminho dado.
public:
ManagementPath(System::String ^ path);
public ManagementPath(string path);
new System.Management.ManagementPath : string -> System.Management.ManagementPath
Public Sub New (path As String)
Parâmetros
- path
- String
O caminho do objeto.
Exemplos
O exemplo seguinte demonstra como a ManagementPath classe analisa um caminho para um objeto WMI. O caminho que é analisado no exemplo é um caminho para uma instância de uma classe.
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
Observações
Segurança do .NET Framework
Confiança total no contacto imediato. Este membro não pode ser utilizado por código parcialmente confiável. Para mais informações, consulte Utilização de Bibliotecas de Código Parcialmente Confiável.