ArrangedElementCollection Class

Definition

表示对象的集合。Represents a collection of objects.

public ref class ArrangedElementCollection : System::Collections::IList
public class ArrangedElementCollection : System.Collections.IList
type ArrangedElementCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public Class ArrangedElementCollection
Implements IList
Inheritance
ArrangedElementCollection
Derived
Implements

Remarks

ArrangedElementCollection 类表示对象的集合,这些对象在设计图面上或在父 System.Windows.Forms.ContainerControl内排列。The ArrangedElementCollection class represents a collection of objects arranged on a design surface or inside a parent System.Windows.Forms.ContainerControl.

ArrangedElementCollection 中没有公开定义的构造函数,因为它设计为仅在 .NET Framework.NET Framework内部使用。There are no publicly defined constructors in ArrangedElementCollection because it is designed to be used only internally within the .NET Framework.NET Framework. 但是,开发人员可以使用派生自 ArrangedElementCollection的类,如 System.Windows.Forms.Control.ControlCollectionHowever, classes derived from ArrangedElementCollection, such as System.Windows.Forms.Control.ControlCollection, are available to the developer.

Properties

Count

获取集合中的元素数。Gets the number of elements in the collection.

IsReadOnly

获取一个值,该值指示集合是否是只读的。Gets a value indicating whether the collection is read-only.

Methods

CopyTo(Array, Int32)

从目标数组的指定索引处开始将此集合的全部内容复制到兼容的一维 ArrayCopies the entire contents of this collection to a compatible one-dimensional Array, starting at the specified index of the target array.

Equals(Object)

确定两个 ArrangedElementCollection 实例是否相等。Determines whether two ArrangedElementCollection instances are equal.

GetEnumerator()

返回一个用于访问整个集合的枚举数。Returns an enumerator for the entire collection.

GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

GetType()

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

(Inherited from Object)
MemberwiseClone()

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

(Inherited from Object)
ToString()

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

(Inherited from Object)

Explicit Interface Implementations

ICollection.IsSynchronized

有关此成员的说明,请参见 IsSynchronized 属性。For a description of this member, see the IsSynchronized property.

ICollection.SyncRoot

有关此成员的说明,请参见 SyncRoot 属性。For a description of this member, see the SyncRoot property.

IList.Add(Object)

有关此成员的说明,请参见 Add(Object) 方法。For a description of this member, see the Add(Object) method.

IList.Clear()

有关此成员的说明,请参见 Clear() 方法。For a description of this member, see the Clear() method.

IList.Contains(Object)

有关此成员的说明,请参见 Contains(Object) 方法。For a description of this member, see the Contains(Object) method.

IList.IndexOf(Object)

有关此成员的说明,请参见 IndexOf(Object) 方法。For a description of this member, see the IndexOf(Object) method.

IList.Insert(Int32, Object)

有关此成员的说明,请参见 Insert(Int32, Object) 方法。For a description of this member, see the Insert(Int32, Object) method.

IList.IsFixedSize

有关此成员的说明,请参见 IsFixedSize 属性。For a description of this member, see the IsFixedSize property.

IList.Item[Int32]

有关此成员的说明,请参见 Item[Int32] 属性。For a description of this member, see the Item[Int32] property.

IList.Remove(Object)

有关此成员的说明,请参见 Remove(Object) 方法。For a description of this member, see the Remove(Object) method.

IList.RemoveAt(Int32)

有关此成员的说明,请参见 RemoveAt(Int32) 方法。For a description of this member, see the RemoveAt(Int32) method.

Extension Methods

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable)

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

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

Applies to

Thread Safety

此类型的公共 staticShared Visual Basic)成员是线程安全的。Public static (Shared in Visual Basic) members of this type are thread safe. 实例成员不一定是线程安全的。Instance members are not guaranteed to be thread safe.

只要没有修改集合,ArrangedElementCollection 就可以同时支持多个读取器。An ArrangedElementCollection can support multiple readers concurrently, as long as the collection is not modified. GetEnumerator() 方法返回可用于访问元素的 IEnumeratorThe GetEnumerator() method returns an IEnumerator that can be used to access elements.

枚举整个集合本质上不是一个线程安全的过程。Enumerating through a collection is intrinsically not a thread-safe procedure. 即使集合是同步的,其他线程仍可以修改集合,这会导致枚举器引发异常。Even when a collection is synchronized, other threads could still modify the collection, which causes the enumerator to throw an exception. 若要确保枚举过程中的线程安全性,可以在整个枚举期间锁定集合,或者捕获由其他线程进行的更改所导致的异常。To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

See also