MethodData.OutParameters 属性

定义

获取方法的输出参数。Gets the output parameters to the method. 将每个参数都描述为对象的一个属性。Each parameter is described as a property in the object. 如果一个参数既是输入参数又是输出参数,则该参数将同时出现在 InParametersOutParameters 属性中。If a parameter is both in and out, it will appear in both the InParameters and OutParameters properties.

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

属性值

ManagementBaseObject

返回一个 ManagementBaseObject,它包含方法的输出参数。Returns a ManagementBaseObject containing the output parameters for the method.

示例

下面的示例使用类列出有关Win32_Process的信息。 MethodDataThe following example lists information about the Win32_Process.Create method using the MethodData class. 有关Win32_Process类的详细信息,请参阅Windows Management Instrumentation文档。For more information on the Win32_Process class, see the Windows Management Instrumentation documentation.

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

注解

此对象中的每个参数都应有 ID 限定符来识别方法调用中参数的顺序。Each parameter in this object should have an ID qualifier to identify the order of the parameters in the method call.

ReturnValue属性是由属性返回的的特殊属性 ManagementBaseObject ,它 OutParameters 包含方法的返回值。The ReturnValue property is a special property of the ManagementBaseObject returned by the OutParameters property and holds the return value of the method.

属性值Property Value

一个, ManagementBaseObject 其中包含方法的所有输出参数。A ManagementBaseObject containing all the output parameters to the method.

.NET Framework 安全性.NET Framework Security

对直接调用方的完全信任。Full trust for the immediate caller. 此成员不能由部分信任的代码使用。This member cannot be used by partially trusted code. 有关详细信息,请参阅从部分受信任的代码使用库For more information, see Using Libraries from Partially Trusted Code.

适用于