System.Collections.Specialized Namespace 以你之姓@ 2021-07-04 20:14 242阅读 0赞 `System.Collections.Specialized` 命名空间包含专用的和强类型的集合,例如,链接的列表词典、位向量以及只包含字符串的集合。 ## 类 ## <table> <thead> <tr> <th>名称</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td><code>CollectionChangedEventManager</code></td> <td>提供 <code>WeakEventManager</code> 实现,以便可以使用“弱事件侦听器”模式附加 <code>CollectionChanged</code> 事件的侦听器。</td> </tr> <tr> <td><code>CollectionsUtil</code></td> <td>创建忽略字符串大小写的集合。</td> </tr> <tr> <td><code>HybridDictionary</code></td> <td>通过以下方法来实现 IDictionary:在集合较小时使用 ListDictionary,然后在集合变大时切换到 Hashtable。</td> </tr> <tr> <td><code>ListDictionary</code></td> <td>使用单向链接列表实现 IDictionary。 对于通常包含少于 10 项的集合,建议使用该实现方法。</td> </tr> <tr> <td><code>NameObjectCollectionBase</code></td> <td>为关联的 abstract 键和 String 值的集合(可通过键或索引来访问它)提供 Object 基类。</td> </tr> <tr> <td><code>NameObjectCollectionBase.KeysCollection</code></td> <td>表示集合中 String 密钥的集合。</td> </tr> <tr> <td><code>NameValueCollection</code></td> <td>表示可通过键或索引访问的关联 String 键和 String 值的集合。</td> </tr> <tr> <td><code>NotifyCollectionChangedEventArgs</code></td> <td>为 CollectionChanged 事件提供数据。</td> </tr> <tr> <td><code>OrderedDictionary</code></td> <td>表示可通过键或索引访问的键/值对的集合。</td> </tr> <tr> <td><code>StringCollection</code></td> <td>表示字符串的集合。</td> </tr> <tr> <td><code>StringDictionary</code></td> <td>使用字符串(而不是对象)强类型的键和值来实现哈希表。</td> </tr> <tr> <td><code>StringEnumerator</code></td> <td>支持对 StringCollection 执行简单迭代。</td> </tr> </tbody> </table> ## Structs ## <table> <thead> <tr> <th>名称</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td><code>BitVector32</code></td> <td>提供一个简单结构,该结构以 32 位内存存储布尔值和小整数。</td> </tr> <tr> <td><code>BitVector32.Section</code></td> <td>表示可以包含整数的向量部分。</td> </tr> </tbody> </table> ## 接口 ## <table> <thead> <tr> <th>名称</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td><code>INotifyCollectionChanged</code></td> <td>例如,当添加和删除项或清除整个列表时,向侦听器通知动态更改。</td> </tr> <tr> <td><code>IOrderedDictionary</code></td> <td>表示键/值对的索引集合。</td> </tr> </tbody> </table> ## 枚举 ## <table> <thead> <tr> <th>名称</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td><code>NotifyCollectionChangedAction</code></td> <td>描述导致 <code>CollectionChanged</code> 事件的操作。</td> </tr> </tbody> </table> ## 委托 ## <table> <thead> <tr> <th>名称</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td><code>NotifyCollectionChangedEventHandler</code></td> <td>表示 <code>CollectionChanged</code> 事件的处理方法。</td> </tr> </tbody> </table> ## 备注 ## 专用的集合是具有专门用途的集合。 `NameValueCollection` 基于`NameObjectCollectionBase`; 但是,`NameValueCollection`接受每个密钥,多个值,而`NameObjectCollectionBase`接受每个密钥只有一个值。 某些强类型集合中的`System.Collections.Specialized`命名空间`StringCollection`和`StringDictionary`,这两个包含的全都是字符串值。 `CollectionsUtil`类创建的不区分大小写的集合实例。 一些集合转换。 例如,`HybridDictionary`类以启动`ListDictionary`并成为`Hashtable`变大。 `KeyedCollection<TKey,TItem>`是一个列表,但它的元素数达到指定的阈值时还创建一个查找字典。
还没有评论,来说两句吧...