ManagementObjectCollection Class (System.Management)

Switch View :
ScriptFree
.NET Framework Class Library
ManagementObjectCollection Class

Represents different collections of management objects retrieved through WMI. The objects in this collection are of ManagementBaseObject-derived types, including ManagementObject and ManagementClass. The collection can be the result of a WMI query executed through a ManagementObjectSearcher, or an enumeration of management objects of a specified type retrieved through a ManagementClass representing that type. In addition, this can be a collection of management objects related in a specified way to a specific management object - in this case the collection would be retrieved through a method such as GetRelated(). The collection can be walked using the ManagementObjectCollection.ManagementObjectEnumerator and objects in it can be inspected or manipulated for various management tasks.

Inheritance Hierarchy

System.Object
  System.Management.ManagementObjectCollection

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

Visual Basic
Public Class ManagementObjectCollection _
	Implements ICollection, IEnumerable, IDisposable
C#
public class ManagementObjectCollection : ICollection, 
	IEnumerable, IDisposable
Visual C++
public ref class ManagementObjectCollection : ICollection, 
	IEnumerable, IDisposable
F#
type ManagementObjectCollection =  
    class
        interface ICollection
        interface IEnumerable
        interface IDisposable
    end

The ManagementObjectCollection type exposes the following members.

Properties

  Name Description
Public property Count Gets a value indicating the number of objects in the collection.
Public property IsSynchronized Gets a value indicating whether the object is synchronized.
Public property SyncRoot Gets the object to be used for synchronization.
Top
Methods

  Name Description
Public method CopyTo(Array, Int32) Copies the collection to an array.
Public method CopyTo(ManagementBaseObject[], Int32) Copies the items in the collection to a ManagementBaseObject array.
Public method Dispose Releases resources associated with this object. After this method has been called, an attempt to use this object will result in an ObjectDisposedException being thrown.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Disposes of resources the object is holding. This is the destructor for the object. Finalizers are expressed using destructor syntax. (Overrides Object.Finalize().)
Public method GetEnumerator Returns the enumerator for the collection.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top
Extension Methods

  Name Description
Public Extension Method AsParallel Enables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension Method AsQueryable Converts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension Method Cast<TResult> Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension Method OfType<TResult> Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top
Explicit Interface Implementations

  Name Description
Explicit interface implemetation Private method IEnumerable.GetEnumerator Returns an IEnumerator that iterates through the ManagementObjectCollection.
Top
Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Thread Safety

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

Reference