System::Collections::Generic::ICollection 类

ICollection class

元素集合的接口。此类的对象只能使用 System::MakeObject() 函数分配。切勿在栈上或使用 operator new 创建此类型的实例,因为这会导致运行时错误和/或断言故障。始终将此类包装到 System::SmartPtr 指针中,并使用该指针将其作为参数传递给函数。

template<typename T>class ICollection : public virtual System::Collections::Generic::IEnumerable<T>

方法

方法描述
virtual Add(const T&)向集合中添加元素。
virtual Clear()删除集合中的所有元素。
virtual Contains(const T&) const检查集合中是否存在该元素。
virtual CopyTo(System::ArrayPtr<T>, int)将所有集合元素复制到现有数组元素中。
virtual get_Count() const获取集合中的元素数量。
virtual get_IsReadOnly() const检查集合是否为只读。
get_SyncRoot() const获取集合同步所通过的对象。
ICollection()默认构造函数。
ICollection(const ICollection&)拷贝构造函数。
ICollection(ICollection&&)移动构造函数。
operator=(ICollection&&)移动赋值运算符。
operator=(const ICollection&)移动赋值运算符。
virtual Remove(const T&)从集合中删除元素。
virtual ~ICollection()析构函数。

Typedefs

类型定义描述
ThisType集合类型名称。
ValueTypeRTTI 信息。

另见