ArrangedElementCollection 类

定义

表示对象集合。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
继承
ArrangedElementCollection
派生
实现

注解

类表示对象的集合, 这些对象在设计图面上或在父项System.Windows.Forms.ContainerControl内排列。 ArrangedElementCollectionThe 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.ControlCollection如) 可供开发人员使用。However, classes derived from ArrangedElementCollection, such as System.Windows.Forms.Control.ControlCollection, are available to the developer.

属性

Count

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

IsReadOnly

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

方法

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.

(继承自 Object)
MemberwiseClone()

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

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式界面实现

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.

扩展方法

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.

适用于

线程安全性

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

只要不修改集合,就可以同时支持多个读取器。ArrangedElementCollectionAn ArrangedElementCollection can support multiple readers concurrently, as long as the collection is not modified. 方法返回可用于访问元素的。IEnumerator GetEnumerator()The 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.

另请参阅