MethodData.OutParameters Właściwość
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Pobiera parametry wyjściowe do metody . Każdy parametr jest opisany jako właściwość w obiekcie. Jeśli parametr znajduje się zarówno w elem, jak i na wyjęcie, pojawi się zarówno we właściwościach , jak InParameters i OutParameters .
public:
property System::Management::ManagementBaseObject ^ OutParameters { System::Management::ManagementBaseObject ^ get(); };
public System.Management.ManagementBaseObject OutParameters { get; }
member this.OutParameters : System.Management.ManagementBaseObject
Public ReadOnly Property OutParameters As ManagementBaseObject
Wartość właściwości
Zwraca wartość zawierającą ManagementBaseObject parametry wyjściowe dla metody .
Przykłady
W poniższym przykładzie wymieniono informacje o metodzie Win32_Process.Create przy użyciu MethodData klasy . Aby uzyskać więcej informacji na temat klasy Win32_Process , zobacz dokumentację instrumentacji zarządzania Windows .
using System;
using System.Management;
public class Sample
{
public static void Main()
{
// Get the WMI class
ManagementClass processClass =
new ManagementClass("Win32_Process");
processClass.Options.UseAmendedQualifiers = true;
// Get the methods in the class
MethodDataCollection methods =
processClass.Methods;
// display the method names
Console.WriteLine("Method Name: ");
foreach (MethodData method in methods)
{
if(method.Name.Equals("Create"))
{
Console.WriteLine(method.Name);
Console.WriteLine("Description: " +
method.Qualifiers["Description"].Value);
Console.WriteLine();
Console.WriteLine("In-parameters: ");
foreach(PropertyData i in
method.InParameters.Properties)
{
Console.WriteLine(i.Name);
}
Console.WriteLine();
Console.WriteLine("Out-parameters: ");
foreach(PropertyData o in
method.OutParameters.Properties)
{
Console.WriteLine(o.Name);
}
Console.WriteLine();
Console.WriteLine("Qualifiers: ");
foreach(QualifierData q in
method.Qualifiers)
{
Console.WriteLine(q.Name);
}
Console.WriteLine();
}
}
}
}
Imports System.Management
Public Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class
Dim processClass As ManagementClass = _
New ManagementClass("Win32_Process")
processClass.Options.UseAmendedQualifiers = True
' Get the methods in the class
Dim methods As MethodDataCollection = _
processClass.Methods
' display the method names
Console.WriteLine("Method Name: ")
For Each method As MethodData In methods
If (method.Name.Equals("Create")) Then
Console.WriteLine(method.Name)
Console.WriteLine("Description: " & _
method.Qualifiers("Description").Value)
Console.WriteLine()
Console.WriteLine("In-parameters: ")
For Each i As PropertyData In _
method.InParameters.Properties
Console.WriteLine(i.Name)
Next
Console.WriteLine()
Console.WriteLine("Out-parameters: ")
For Each o As PropertyData In _
method.OutParameters.Properties
Console.WriteLine(o.Name)
Next
Console.WriteLine()
Console.WriteLine("Qualifiers: ")
For Each q As QualifierData In _
method.Qualifiers
Console.WriteLine(q.Name)
Next
Console.WriteLine()
End If
Next
End Function 'Main
End Class
Uwagi
Każdy parametr w tym obiekcie powinien mieć kwalifikator identyfikatora, aby zidentyfikować kolejność parametrów w wywołaniu metody.
Właściwość ReturnValue jest specjalną właściwością ManagementBaseObject zwracaną przez OutParameters właściwość i przechowuje wartość zwracaną przez metodę.
Wartość właściwości
Element ManagementBaseObject zawierający wszystkie parametry wyjściowe metody .
Zabezpieczenia programu .NET Framework
Pełne zaufanie dla bezpośredniego obiektu wywołującego. Tego elementu członkowskiego nie można używać przez częściowo zaufany kod. Aby uzyskać więcej informacji, zobacz Using Libraries from Partially Trusted Code (Używanie bibliotek z częściowo zaufanego kodu).