1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
|
<?xml version="1.0" encoding="utf-8"?>
<Type Name="KeyedCollection<TKey,TItem>" FullName="System.Collections.ObjectModel.KeyedCollection<TKey,TItem>">
<TypeSignature Language="C#" Value="public abstract class KeyedCollection<TKey,TItem> : System.Collections.ObjectModel.Collection<TItem>" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract serializable beforefieldinit KeyedCollection`2<TKey, TItem> extends System.Collections.ObjectModel.Collection`1<!TItem>" />
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeParameters>
<TypeParameter Name="TKey" />
<TypeParameter Name="TItem" />
</TypeParameters>
<Base>
<BaseTypeName>System.Collections.ObjectModel.Collection<TItem></BaseTypeName>
<BaseTypeArguments>
<BaseTypeArgument TypeParamName="T">TItem</BaseTypeArgument>
</BaseTypeArguments>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName>System.Diagnostics.DebuggerDisplay("Count={Count}")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.Generic.CollectionDebuggerView`2))</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
</Attribute>
</Attributes>
<Docs>
<typeparam name="TKey">To be added.</typeparam>
<typeparam name="TItem">To be added.</typeparam>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> class provides both O(1) indexed retrieval and keyed retrieval that approaches O(1). It is an abstract type, or more accurately an infinite set of abstract types, because each of its constructed generic types is an abstract base class. To use <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />, derive your collection type from the appropriate constructed type.</para>
<para>The <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> class is a hybrid between a collection based on the <see cref="T:System.Collections.Generic.IList`1" /> generic interface and a collection based on the <see cref="T:System.Collections.Generic.IDictionary`2" /> generic interface. Like collections based on the <see cref="T:System.Collections.Generic.IList`1" /> generic interface, <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> is an indexed list of items. Like collections based on the <see cref="T:System.Collections.Generic.IDictionary`2" /> generic interface, <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> has a key associated with each element. </para>
<para>Unlike dictionaries, an element of <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> is not a key/value pair; instead, the entire element is the value and the key is embedded within the value. For example, an element of a collection derived from KeyedCollection<String,String> (KeyedCollection(Of String, String) in Visual Basic) might be "John Doe Jr." where the value is "John Doe Jr." and the key is "Doe"; or a collection of employee records containing integer keys could be derived from KeyedCollection<int,Employee>. The abstract <see cref="M:System.Collections.ObjectModel.KeyedCollection`2.GetKeyForItem(`1)" /> method extracts the key from the element.</para>
<para>By default, the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> includes a lookup dictionary that you can obtain with the <see cref="P:System.Collections.ObjectModel.KeyedCollection`2.Dictionary" /> property. When an item is added to the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />, the item's key is extracted once and saved in the lookup dictionary for faster searches. This behavior is overridden by specifying a dictionary creation threshold when you create the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />. The lookup dictionary is created the first time the number of elements exceeds that threshold. If you specify –1 as the threshold, the lookup dictionary is never created. </para>
<block subset="none" type="note">
<para>When the internal lookup dictionary is used, it contains references to all the items in the collection if <paramref name="TItem" /> is a reference type, or copies of all the items in the collection if <paramref name="TItem" /> is a value type. Thus, using the lookup dictionary may not be appropriate if <paramref name="TItem" /> is a value type.</para>
</block>
<para>You can access an item by its index or key by using the <see cref="P:System.Collections.ObjectModel.KeyedCollection`2.Item(`0)" /> property. You can add items without a key, but these items can subsequently be accessed only by index.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Provides the abstract base class for a collection whose keys are embedded in the values.</para>
</summary>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected KeyedCollection ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>A <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> created with this constructor uses the default generic equality comparer for the type of the key, obtained from <see cref="P:System.Collections.Generic.EqualityComparer`1.Default" />. To specify a different generic equality comparer, use the <see cref="M:System.Collections.ObjectModel.KeyedCollection`2.#ctor(System.Collections.Generic.IEqualityComparer{`0})" /> constructor or the <see cref="M:System.Collections.ObjectModel.KeyedCollection`2.#ctor(System.Collections.Generic.IEqualityComparer{`0},System.Int32)" /> constructor.</para>
<para>By default, the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> includes a lookup dictionary that is created when the first item is added. When an item is added to the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />, the item's key is extracted once and saved in the lookup dictionary for faster searches. This behavior can be overridden by using the <see cref="M:System.Collections.ObjectModel.KeyedCollection`2.#ctor(System.Collections.Generic.IEqualityComparer{`0},System.Int32)" /> constructor and specifying a dictionary creation threshold. </para>
<block subset="none" type="note">
<para>Because the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> class is abstract (MustInherit in Visual Basic), you must derive from it in order to use it. In the constructor for your derived type, call the appropriate <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> constructor. It is not necessary to expose functionality like the equality comparer or the dictionary creation threshold in your constructors.</para>
</block>
<para>This constructor is an O(1) operation.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> class that uses the default equality comparer.</para>
</summary>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected KeyedCollection (System.Collections.Generic.IEqualityComparer<TKey> comparer);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEqualityComparer`1<!TKey> comparer) cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="comparer" Type="System.Collections.Generic.IEqualityComparer<TKey>" />
</Parameters>
<Docs>
<param name="comparer">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected KeyedCollection (System.Collections.Generic.IEqualityComparer<TKey> comparer, int dictionaryCreationThreshold);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEqualityComparer`1<!TKey> comparer, int32 dictionaryCreationThreshold) cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="comparer" Type="System.Collections.Generic.IEqualityComparer<TKey>" />
<Parameter Name="dictionaryCreationThreshold" Type="System.Int32" />
</Parameters>
<Docs>
<param name="comparer">To be added.</param>
<param name="dictionaryCreationThreshold">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
<Member MemberName="ChangeItemKey">
<MemberSignature Language="C#" Value="protected void ChangeItemKey (TItem item, TKey newKey);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig instance void ChangeItemKey(!TItem item, !TKey newKey) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="item" Type="TItem" />
<Parameter Name="newKey" Type="TKey" />
</Parameters>
<Docs>
<param name="item">To be added.</param>
<param name="newKey">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
<Member MemberName="ClearItems">
<MemberSignature Language="C#" Value="protected override void ClearItems ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void ClearItems() cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>If there is a lookup dictionary, this method clears it but does not delete it.</para>
<para>If the number of elements has exceeded the dictionary creation threshold and the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> is using a lookup dictionary, it will continue to use a lookup dictionary even though the number of elements is again under the threshold.</para>
<para>This method is an O(<paramref name="n" />) operation, where <paramref name="n" /> is <see cref="P:System.Collections.ObjectModel.Collection`1.Count" />.</para>
<format type="text/html">
<h2>Notes for Implementers</h2>
</format>
<para>Override this method to provide customized behavior for the <see cref="M:System.Collections.ObjectModel.Collection`1.Clear" /> method, inherited from the <see cref="T:System.Collections.ObjectModel.Collection`1" /> generic class. </para>
<para>Call the base class implementation of this method to clear the underlying collection and to clear the lookup dictionary.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Removes all elements from the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />.</para>
</summary>
</Docs>
</Member>
<Member MemberName="Comparer">
<MemberSignature Language="C#" Value="public System.Collections.Generic.IEqualityComparer<TKey> Comparer { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEqualityComparer`1<!TKey> Comparer" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.Generic.IEqualityComparer<TKey></ReturnType>
</ReturnValue>
<Docs>
<value>To be added.</value>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Retrieving the value of this property is an O(1) operation.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Gets the generic equality comparer that is used to determine equality of keys in the collection.</para>
</summary>
</Docs>
</Member>
<Member MemberName="Contains">
<MemberSignature Language="C#" Value="public bool Contains (TKey key);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Contains(!TKey key) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="key" Type="TKey" />
</Parameters>
<Docs>
<param name="key">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
<Member MemberName="Dictionary">
<MemberSignature Language="C#" Value="protected System.Collections.Generic.IDictionary<TKey,TItem> Dictionary { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IDictionary`2<!TKey, !TItem> Dictionary" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.Generic.IDictionary<TKey,TItem></ReturnType>
</ReturnValue>
<Docs>
<value>To be added.</value>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>By default, the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> includes a lookup dictionary that is created when the first item is added. When an item is added to the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />, the item's key is extracted once and saved in the lookup dictionary for faster searches. This behavior can be overridden by using the <see cref="M:System.Collections.ObjectModel.KeyedCollection`2.#ctor(System.Collections.Generic.IEqualityComparer{`0},System.Int32)" /> constructor and specifying a dictionary creation threshold. </para>
<para>Retrieving the value of this property is an O(1) operation.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Gets the lookup dictionary of the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />.</para>
</summary>
</Docs>
</Member>
<Member MemberName="GetKeyForItem">
<MemberSignature Language="C#" Value="protected abstract TKey GetKeyForItem (TItem item);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance !TKey GetKeyForItem(!TItem item) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>TKey</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="item" Type="TItem" />
</Parameters>
<Docs>
<param name="item">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
<Member MemberName="InsertItem">
<MemberSignature Language="C#" Value="protected override void InsertItem (int index, TItem item);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void InsertItem(int32 index, !TItem item) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="item" Type="TItem" />
</Parameters>
<Docs>
<param name="index">To be added.</param>
<param name="item">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
<Member MemberName="Item">
<MemberSignature Language="C#" Value="public TItem this[TKey key] { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance !TItem Item(!TKey)" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>TItem</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="key" Type="TKey" />
</Parameters>
<Docs>
<param name="key">To be added.</param>
<summary>To be added.</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
<Member MemberName="Remove">
<MemberSignature Language="C#" Value="public bool Remove (TKey key);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Remove(!TKey key) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="key" Type="TKey" />
</Parameters>
<Docs>
<param name="key">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
<Member MemberName="RemoveItem">
<MemberSignature Language="C#" Value="protected override void RemoveItem (int index);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void RemoveItem(int32 index) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The key of the element is also removed from the lookup dictionary.</para>
<para>If the number of elements has exceeded the dictionary creation threshold and the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" /> is using a lookup dictionary, it will continue to use a lookup dictionary even though the number of elements is again under the threshold.</para>
<para>This method is an O(<paramref name="n" />) operation, where <paramref name="n" /> is <see cref="P:System.Collections.ObjectModel.Collection`1.Count" />.</para>
<format type="text/html">
<h2>Notes for Implementers</h2>
</format>
<para>Override this method to provide customized behavior for the <see cref="M:System.Collections.ObjectModel.Collection`1.Remove(`0)" /> and <see cref="M:System.Collections.ObjectModel.Collection`1.RemoveAt(System.Int32)" /> methods, inherited from the <see cref="T:System.Collections.ObjectModel.Collection`1" /> generic class, and the <see cref="M:System.Collections.ObjectModel.KeyedCollection`2.Remove(`0)" /> method. </para>
<para>Call the base class implementation of this method to remove the item from the underlying collection and to update the lookup dictionary.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Removes the element at the specified index of the <see cref="T:System.Collections.ObjectModel.KeyedCollection`2" />.</para>
</summary>
<param name="index">
<attribution license="cc4" from="Microsoft" modified="false" />The index of the element to remove.</param>
</Docs>
</Member>
<Member MemberName="SetItem">
<MemberSignature Language="C#" Value="protected override void SetItem (int index, TItem item);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void SetItem(int32 index, !TItem item) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="item" Type="TItem" />
</Parameters>
<Docs>
<param name="index">To be added.</param>
<param name="item">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
</Members>
</Type>
|