System::Collections::ObjectModel::KeyedCollection class

KeyedCollection class

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

template<typename TKey,typename TItem>class KeyedCollection : public System::Collections::ObjectModel::Collection<TItem>
Parameter描述
TKey密钥类型。
TItem值类型。

方法

方法描述
Add(const TItem&) override将项目添加到容器末尾。
Contains(TKey)检查键是否存在于容器中。
get_Comparer()获取比较器。
idx_get(TKey)获取特定索引处的项目。
Remove(TKey)从容器中移除键。
SetTemplateWeakPtr(uint32_t) override将特定模板参数视为弱指针而非共享指针(如果适用)。

字段

字段描述
static defaultThreshold查找字典创建阈值,默认。

另见