title: Whats the difference between indexed retrieval and keyed retrieval
body: <p>Looking at the docs for <code>KeyedCollection</code> i read the following::</p>
  
  <blockquote>
    <p>The KeyedCollection class provides both O(1) indexed retrieval and keyed retrieval that approaches O(1). </p>
  </blockquote>
  
  <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.keyedcollection-2?view=netcore-3.1" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.keyedcollection-2?view=netcore-3.1</a></p>
  
  <p>I do not fully understand what this means. I personally would think that indexed retrieval and keyed retrieval are the same since a dictionary indexes by keys. I feel a bit vague about the terms 'indexed retrieval' and 'keyed retrieval' altogether i suppose.</p>
  
  <p>So what's the difference, and why is the complexion different? </p>
  
  <p>Additional info:
  I personally would like to use the <code>keyedCollection</code> because I have a list that will be added to a lot. Now and then i need to fetch an item by an id - a <code>Guid</code> and return some data. I also periodically will  go through the list and delete any items i no longer use.</p>
  
  <p>Sample;</p>
  
  <pre><code>    /// &lt;summary&gt;
      /// A collection of leases. Implements &lt;see cref="KeyedCollection{TKey,TItem}"/&gt; which is a dictionary-list hybrid.
      /// &lt;/summary&gt;
      public class LeaseInfoCollection : KeyedCollection&lt;Guid, LeaseInfo&gt;
      {
          #region Construction and Destruction
  
          /// &lt;inheritdoc /&gt;
          public LeaseInfoCollection()
          {
          }
  
          /// &lt;inheritdoc /&gt;
          public LeaseInfoCollection(IEqualityComparer&lt;Guid&gt; comparer)
              : base(comparer)
          {
          }
  
          /// &lt;inheritdoc /&gt;
          public LeaseInfoCollection(IEqualityComparer&lt;Guid&gt; comparer, int dictionaryCreationThreshold)
              : base(comparer, dictionaryCreationThreshold)
          {
          }
  
          #endregion
  
          #region Overrides of KeyedCollection&lt;string,LeaseInfo&gt;
  
          /// &lt;inheritdoc /&gt;
          protected override Guid GetKeyForItem(LeaseInfo item)
          {
              return item.LeaseId;
          }
  
          #endregion
      }
  </code></pre>