Editar

Compartilhar via


ManagementBaseObject.GetText(TextFormat) Method

Definition

Returns a textual representation of the object in the specified format.

public:
 System::String ^ GetText(System::Management::TextFormat format);
public string GetText (System.Management.TextFormat format);
member this.GetText : System.Management.TextFormat -> string
Public Function GetText (format As TextFormat) As String

Parameters

format
TextFormat

The requested textual format.

Returns

The textual representation of the object in the specified format.

Examples

The following example displays the MOF code for the Win32_Process class by using the GetText method. For more information about 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;

        Console.WriteLine(
            processClass.GetText(
            TextFormat.Mof));
    }
}
Imports System.Management


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

        ' Get the WMI class
        Dim processClass As New ManagementClass( _
            "Win32_Process")
        processClass.Options.UseAmendedQualifiers = True

        Console.WriteLine( _
            processClass.GetText( _
            TextFormat.Mof))

    End Function
End Class

Remarks

Currently, the only format that WMI supports is Managed Object Format (MOF). In the future, other formats will be supported, such as Extensible Markup Language (XML).

.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.

Applies to