[]
        
(Showing Draft Content)

GrapeCity.Documents.Common.OwnedKeyedCollection-2

Class OwnedKeyedCollection<TKey, TItem>

Namespace
GrapeCity.Documents.Common
Assembly
GcDocs.Imaging.dll

Represents an OwnedCollection<TItem> of uniquely elements, each element should have unique key.

public abstract class OwnedKeyedCollection<TKey, TItem> : OwnedCollection<TItem>, IList<TItem>, ICollection<TItem>, IReadOnlyList<TItem>, IReadOnlyCollection<TItem>, IEnumerable<TItem>, IOwnedObject, IList, ICollection, IEnumerable where TItem : IOwnedObject

Type Parameters

TKey

The type of keys in the collection.

TItem

The type of items in the collection.

Inheritance
object
System.Collections.ObjectModel.Collection<T><TItem>
OwnedKeyedCollection<TKey, TItem>
Implements
System.Collections.Generic.IList<T><TItem>
System.Collections.Generic.ICollection<T><TItem>
System.Collections.Generic.IReadOnlyList<T><TItem>
System.Collections.Generic.IReadOnlyCollection<T><TItem>
System.Collections.Generic.IEnumerable<T><TItem>
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
Inherited Members
System.Collections.ObjectModel.Collection<TItem>.Add(TItem)
System.Collections.ObjectModel.Collection<TItem>.Clear()
System.Collections.ObjectModel.Collection<TItem>.CopyTo(TItem[], int)
System.Collections.ObjectModel.Collection<TItem>.Contains(TItem)
System.Collections.ObjectModel.Collection<TItem>.GetEnumerator()
System.Collections.ObjectModel.Collection<TItem>.IndexOf(TItem)
System.Collections.ObjectModel.Collection<TItem>.Insert(int, TItem)
System.Collections.ObjectModel.Collection<TItem>.Remove(TItem)
System.Collections.ObjectModel.Collection<TItem>.RemoveAt(int)
System.Collections.ObjectModel.Collection<TItem>.Count
System.Collections.ObjectModel.Collection<TItem>.Items
System.Collections.ObjectModel.Collection<TItem>.this[int]
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

OwnedKeyedCollection()

protected OwnedKeyedCollection()

Methods

CheckKey(TItem, TKey, TKey)

Throws an exception if collection already contains item with specified key.

public virtual void CheckKey(TItem item, TKey oldKey, TKey newKey)

Parameters

item TItem

The item to check.

oldKey TKey

The old key.

newKey TKey

The new key.

ClearItems()

protected override void ClearItems()

GetKeyForItem(TItem)

When implemented in a derived class, extracts the key from the specified element.

protected abstract TKey GetKeyForItem(TItem item)

Parameters

item TItem

The element from which to extract the key.

Returns

TKey

The key for the specified element.

IndexOfKey(TKey)

Returns the 0-based index of a TItem with specified key in the current OwnedKeyedCollection<TKey, TItem>.

public int IndexOfKey(TKey key)

Parameters

key TKey

The key of the item to locate.

Returns

int

The 0-based index of the specified item, or -1 if the item was not found.

InsertItem(int, TItem)

protected override void InsertItem(int index, TItem item)

Parameters

index int
item TItem

RemoveItem(int)

protected override void RemoveItem(int index)

Parameters

index int

SetItem(int, TItem)

protected override void SetItem(int index, TItem item)

Parameters

index int
item TItem

TryGetValue(TKey, out TItem)

Get an item with specified key.

public bool TryGetValue(TKey key, out TItem item)

Parameters

key TKey

The key of the item.

item TItem

The item or default value if not found.

Returns

bool

true if item was found, false otherwise.