# GrapeCity.Documents.Common.OwnedKeyedCollection-2

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="GrapeCity_Documents_Common_OwnedKeyedCollection_2" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2" class="text-break">OwnedKeyedCollection&lt;TKey, TItem&gt; Class
</h1>
  <div class="markdown level0 summary"><p>Represents an <a class="xref" href="GrapeCity.Documents.Common.OwnedCollection-1.html">OwnedCollection&lt;TItem&gt;</a> of uniquely elements, each
element should have unique key.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1">Collection</a>&lt;TItem&gt;</div>
    <div class="level2"><a class="xref" href="GrapeCity.Documents.Common.OwnedCollectionBase-1.html">OwnedCollectionBase</a>&lt;TItem&gt;</div>
    <div class="level3"><a class="xref" href="GrapeCity.Documents.Common.OwnedCollection-1.html">OwnedCollection</a>&lt;TItem&gt;</div>
    <div class="level4"><span class="xref">OwnedKeyedCollection&lt;TKey, TItem&gt;</span></div>
  </div>
  <div class="implements">
    <h5>Implements</h5>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.icollection-1">ICollection</a>&lt;TItem&gt;</div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1">IReadOnlyList</a>&lt;TItem&gt;</div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlycollection-1">IReadOnlyCollection</a>&lt;TItem&gt;</div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;TItem&gt;</div>
    <div><a class="xref" href="GrapeCity.Documents.Common.IOwnedObject.html">IOwnedObject</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.ilist">IList</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.icollection">ICollection</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.ienumerable">IEnumerable</a></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="GrapeCity.Documents.Common.html">GrapeCity.Documents.Common</a></h6>
  <h6><strong>Assembly</strong>: DS.Documents.Imaging.dll</h6>
  <h5 id="GrapeCity_Documents_Common_OwnedKeyedCollection_2_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public abstract class OwnedKeyedCollection&lt;TKey, TItem&gt; : OwnedCollection&lt;TItem&gt;, IList&lt;TItem&gt;, ICollection&lt;TItem&gt;, IReadOnlyList&lt;TItem&gt;, IReadOnlyCollection&lt;TItem&gt;, IEnumerable&lt;TItem&gt;, IOwnedObject, IList, ICollection, IEnumerable where TItem : IOwnedObject</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public MustInherit Class OwnedKeyedCollection(Of TKey, TItem As IOwnedObject)
    Inherits OwnedCollection(Of TItem)
    Implements IList(Of TItem), ICollection(Of TItem), IReadOnlyList(Of TItem), IReadOnlyCollection(Of TItem), IEnumerable(Of TItem), IOwnedObject, IList, ICollection, IEnumerable</code></pre>
  </div>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">TKey</span></td>
        <td><p>The type of keys in the collection.</p>
</td>
      </tr>
      <tr>
        <td><span class="parametername">TItem</span></td>
        <td><p>The type of items in the collection.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="GrapeCity_Documents_Common_OwnedKeyedCollection_2__ctor" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2.#ctor">
          <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.-ctor.html#GrapeCity_Documents_Common_OwnedKeyedCollection_2__ctor">OwnedKeyedCollection()</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="GrapeCity_Documents_Common_OwnedKeyedCollection_2_CheckKey__1__0__0_" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2.CheckKey(`1,`0,`0)">
          <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.CheckKey.html#GrapeCity_Documents_Common_OwnedKeyedCollection_2_CheckKey__1__0__0_">CheckKey(TItem, TKey, TKey)</a>
        </td>
        <td class="markdown level1 summary"><p>Throws an exception if collection already contains item with specified key.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Common_OwnedKeyedCollection_2_ClearItems" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2.ClearItems">
          <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.ClearItems.html#GrapeCity_Documents_Common_OwnedKeyedCollection_2_ClearItems">ClearItems()</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Common_OwnedKeyedCollection_2_GetKeyForItem__1_" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2.GetKeyForItem(`1)">
          <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.GetKeyForItem.html#GrapeCity_Documents_Common_OwnedKeyedCollection_2_GetKeyForItem__1_">GetKeyForItem(TItem)</a>
        </td>
        <td class="markdown level1 summary"><p>When implemented in a derived class, extracts the key from the specified element.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Common_OwnedKeyedCollection_2_IndexOfKey__0_" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2.IndexOfKey(`0)">
          <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.IndexOfKey.html#GrapeCity_Documents_Common_OwnedKeyedCollection_2_IndexOfKey__0_">IndexOfKey(TKey)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the 0-based index of a <code class="typeparamref">TItem</code>
with specified key in the current <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.html">OwnedKeyedCollection&lt;TKey, TItem&gt;</a>.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Common_OwnedKeyedCollection_2_InsertItem_System_Int32__1_" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2.InsertItem(System.Int32,`1)">
          <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.InsertItem.html#GrapeCity_Documents_Common_OwnedKeyedCollection_2_InsertItem_System_Int32__1_">InsertItem(int, TItem)</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Common_OwnedKeyedCollection_2_RemoveItem_System_Int32_" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2.RemoveItem(System.Int32)">
          <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.RemoveItem.html#GrapeCity_Documents_Common_OwnedKeyedCollection_2_RemoveItem_System_Int32_">RemoveItem(int)</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Common_OwnedKeyedCollection_2_SetItem_System_Int32__1_" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2.SetItem(System.Int32,`1)">
          <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.SetItem.html#GrapeCity_Documents_Common_OwnedKeyedCollection_2_SetItem_System_Int32__1_">SetItem(int, TItem)</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Common_OwnedKeyedCollection_2_TryGetValue__0__1__" data-uid="GrapeCity.Documents.Common.OwnedKeyedCollection`2.TryGetValue(`0,`1@)">
          <a class="xref" href="GrapeCity.Documents.Common.OwnedKeyedCollection-2.TryGetValue.html#GrapeCity_Documents_Common_OwnedKeyedCollection_2_TryGetValue__0__1__">TryGetValue(TKey, out TItem)</a>
        </td>
        <td class="markdown level1 summary"><p>Get an item with specified key.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
