ManagementObjectCollection ManagementObjectCollection ManagementObjectCollection ManagementObjectCollection Class

定义

表示通过 WMI 检索到的管理对象的不同集合。Represents different collections of management objects retrieved through WMI. 此集合中的对象为从 ManagementBaseObject 派生的类型,包括 ManagementObjectManagementClassThe objects in this collection are of ManagementBaseObject-derived types, including ManagementObject and ManagementClass. 通过 ManagementObjectSearcher 对象执行 WMI 查询,或者通过表示指定类型的 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. 此外,这也可能是以指定方式与特定管理对象相关的管理对象集合 — 在这种情况下,此集合可以通过诸如 GetRelated() 之类的方法检索到。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(). 此集合可以通过 ManagementObjectCollection.ManagementObjectEnumerator 遍历,并且能够针对各种管理任务对集合中的对象进行检查或操作。The collection can be walked using the ManagementObjectCollection.ManagementObjectEnumerator and objects in it can be inspected or manipulated for various management tasks.

public ref class ManagementObjectCollection : IDisposable, System::Collections::ICollection
public class ManagementObjectCollection : IDisposable, System.Collections.ICollection
type ManagementObjectCollection = class
    interface ICollection
    interface IEnumerable
    interface IDisposable
Public Class ManagementObjectCollection
Implements ICollection, IDisposable
继承
ManagementObjectCollectionManagementObjectCollectionManagementObjectCollectionManagementObjectCollection
实现

属性

Count Count Count Count

获取指示集合中的对象数的值。Gets a value indicating the number of objects in the collection.

IsSynchronized IsSynchronized IsSynchronized IsSynchronized

获取一个值,它指示对象是否已同步(线程安全)。Gets a value that indicates whether the object is synchronized (thread-safe).

SyncRoot SyncRoot SyncRoot SyncRoot

获取要用于同步的对象。Gets the object to be used for synchronization.

方法

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

将集合复制到数组。Copies the collection to an array.

CopyTo(ManagementBaseObject[], Int32) CopyTo(ManagementBaseObject[], Int32) CopyTo(ManagementBaseObject[], Int32) CopyTo(ManagementBaseObject[], Int32)

将集合中的项复制到一个 ManagementBaseObject 数组。Copies the items in the collection to a ManagementBaseObject array.

Dispose() Dispose() Dispose() Dispose()

释放与该对象关联的资源。Releases resources associated with this object. 调用该方法后,尝试使用该对象将导致引发 ObjectDisposedExceptionAfter this method has been called, an attempt to use this object will result in an ObjectDisposedException being thrown.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

处置对象所保留的资源。Disposes of resources the object is holding. 这是该对象的析构函数。This is the destructor for the object. 使用析构函数语法表示终结器。Finalizers are expressed using destructor syntax.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回集合的枚举器。Returns the enumerator for the collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

显式界面实现

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

返回循环访问 IEnumeratorManagementObjectCollectionReturns an IEnumerator that iterates through the ManagementObjectCollection.

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于