Udostępnij przez


ManagementClass.Methods Właściwość

Definicja

Pobiera lub ustawia kolekcję MethodData obiektów reprezentujących metody zdefiniowane w klasie WMI.

public:
 property System::Management::MethodDataCollection ^ Methods { System::Management::MethodDataCollection ^ get(); };
public System.Management.MethodDataCollection Methods { get; }
member this.Methods : System.Management.MethodDataCollection
Public ReadOnly Property Methods As MethodDataCollection

Wartość właściwości

Reprezentujący MethodDataCollection metody zdefiniowane w klasie WMI.

Przykłady

W poniższym przykładzie pokazano, jak zainicjować zmienną ManagementClass za pomocą ManagementClass konstruktora, a następnie pobrać wszystkie metody w klasie WMI przekazane do konstruktora.

using System;
using System.Management;

public class Example
{
    public static void Main()
    {
        ManagementClass c =
            new ManagementClass("Win32_Process");
        foreach (MethodData m in c.Methods)
            Console.WriteLine(
                "The class contains this method: {0}", m.Name);
        return;
    }
}
Imports System.Management

Public Class Sample

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

        Dim c As New ManagementClass("Win32_Process")
        Dim m As MethodData
        For Each m In c.Methods
            Console.WriteLine( _
                "This class contains this method : {0}", m.Name)
        Next m

        Return 0
    End Function
End Class

Uwagi

Zabezpieczenia.NET Framework

Pełne zaufanie do bezpośredniego wywołującego. Ten element członkowski nie może być używany przez kod częściowo zaufany. Aby uzyskać więcej informacji, zobacz Using Libraries from Partially Trusted Code (Używanie bibliotek z częściowo zaufanego kodu).

Dotyczy