MethodDataCollection Class

 

Represents the set of methods available in the collection.

Namespace:   System.Management
Assembly:  System.Management (in System.Management.dll)

System.Object
  System.Management.MethodDataCollection

Public Class MethodDataCollection
	Implements ICollection, IEnumerable

NameDescription
System_CAPS_pubpropertyCount

Gets the number of objects in the MethodDataCollection collection.

System_CAPS_pubpropertyIsSynchronized

Gets a value that indicates whether the object is synchronized.

System_CAPS_pubpropertyItem(String)

Gets the specified MethodData from the MethodDataCollection.

System_CAPS_pubpropertySyncRoot

Gets the object to be used for synchronization.

NameDescription
System_CAPS_pubmethodAdd(String)

Adds a MethodData to the MethodDataCollection. This overload will add a new method with no parameters to the collection.

System_CAPS_pubmethodAdd(String, ManagementBaseObject, ManagementBaseObject)

Adds a MethodData to the MethodDataCollection. This overload will add a new method with the specified parameter objects to the collection.

System_CAPS_pubmethodCopyTo(Array, Int32)

Copies the MethodDataCollection into an array.

System_CAPS_pubmethodCopyTo(MethodData(), Int32)

Copies the MethodDataCollection to a specialized MethodData array.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Returns an enumerator for the MethodDataCollection.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodRemove(String)

Removes a MethodData from the MethodDataCollection.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIEnumerable.GetEnumerator()

Returns an IEnumerator that iterates through the MethodDataCollection.

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast(Of TResult)()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType(Of TResult)()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

The following example lists information about the Win32_Process.Create method using the MethodData class. For more information on the Win32_Process class, see the Windows Management Instrumentation documentation in the MSDN Library at http://msdn.microsoft.com/library.

Imports System
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 'Sample

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: