Skip to content

T_CodeJam_Collections_OwnedCollection_3

Andrew Koryavchenko edited this page Jun 17, 2018 · 2 revisions

OwnedCollection(TOwner, TKey, TItem) Class

Keyed collection type that allows to associate collection items with the owner.

Inheritance Hierarchy

System.Object
  System.Collections.ObjectModel.Collection(TItem)
    System.Collections.ObjectModel.KeyedCollection(TKey, TItem)
      CodeJam.Collections.OwnedCollectionBase(TOwner, TKey, TItem)
        CodeJam.Collections.OwnedCollection(TOwner, TKey, TItem)
Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public class OwnedCollection<TOwner, TKey, TItem> : OwnedCollectionBase<TOwner, TKey, TItem>
where TOwner : class
where TItem : class

VB

Public Class OwnedCollection(Of TOwner As Class, TKey, TItem As Class)
	Inherits OwnedCollectionBase(Of TOwner, TKey, TItem)

F#

type OwnedCollection<'TOwner, 'TKey, 'TItem when 'TOwner : not struct when 'TItem : not struct> =  
    class
        inherit OwnedCollectionBase<'TOwner, 'TKey, 'TItem>
    end

Type Parameters

 

TOwner
The type of the owner.
TKey
The type of the key.
TItem
The type of the item.
  The OwnedCollection(TOwner, TKey, TItem) type exposes the following members.

Constructors

 

Name Description
Public method OwnedCollection(TOwner, TKey, TItem) Initializes a new instance of the OwnedCollection(TOwner, TKey, TItem) class.
  Back to Top

Properties

 

Name Description
Public property Comparer Gets the generic equality comparer that is used to determine equality of keys in the collection. (Inherited from KeyedCollection(TKey, TItem).)
Public property Count Gets the number of elements actually contained in the Collection(T). (Inherited from Collection(TItem).)
Protected property Dictionary Gets the lookup dictionary of the KeyedCollection(TKey, TItem). (Inherited from KeyedCollection(TKey, TItem).)
Public property Item(TKey) Gets the element with the specified key. (Inherited from KeyedCollection(TKey, TItem).)
Public property Item(Int32) Gets or sets the element at the specified index. (Inherited from Collection(TItem).)
Protected property Items Gets a IList(T) wrapper around the Collection(T). (Inherited from Collection(TItem).)
Protected property Owner Gets owner for the collection. (Inherited from OwnedCollectionBase(TOwner, TKey, TItem).)
  Back to Top

Methods

 

Name Description
Public method Add Adds an object to the end of the Collection(T). (Inherited from Collection(TItem).)
Protected method ChangeItemKey Changes the key associated with the specified element in the lookup dictionary. (Inherited from KeyedCollection(TKey, TItem).)
Public method Clear Removes all elements from the Collection(T). (Inherited from Collection(TItem).)
Protected method ClearItems Removes all elements from the Collection(T). Clears owner for the items being removed. (Inherited from OwnedCollectionBase(TOwner, TKey, TItem).)
Public method Contains(TKey) Determines whether the collection contains an element with the specified key. (Inherited from KeyedCollection(TKey, TItem).)
Public method Contains(T) Determines whether an element is in the Collection(T). (Inherited from Collection(TItem).)
Public method CopyTo Copies the entire Collection(T) to a compatible one-dimensional Array, starting at the specified index of the target array. (Inherited from Collection(TItem).)
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetEnumerator Returns an enumerator that iterates through the Collection(T). (Inherited from Collection(TItem).)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Protected method GetKey Gets a key for the item. (Overrides OwnedCollectionBase(TOwner, TKey, TItem).GetKey(TItem).)
Protected method GetKeyForItem When implemented in a derived class, extracts the key from the specified element. (Inherited from OwnedCollectionBase(TOwner, TKey, TItem).)
Protected method GetOwner Gets the owner of the item. (Overrides OwnedCollectionBase(TOwner, TKey, TItem).GetOwner(TItem).)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IndexOf Searches for the specified object and returns the zero-based index of the first occurrence within the entire Collection(T). (Inherited from Collection(TItem).)
Public method Insert Inserts an element into the Collection(T) at the specified index. (Inherited from Collection(TItem).)
Protected method InsertItem Inserts an element into the Collection(T) at the specified index. Sets owner for the items being added. (Inherited from OwnedCollectionBase(TOwner, TKey, TItem).)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Remove(TKey) Removes the element with the specified key from the KeyedCollection(TKey, TItem). (Inherited from KeyedCollection(TKey, TItem).)
Public method Remove(T) Removes the first occurrence of a specific object from the Collection(T). (Inherited from Collection(TItem).)
Public method RemoveAt Removes the element at the specified index of the Collection(T). (Inherited from Collection(TItem).)
Protected method RemoveItem Removes the element at the specified index of the Collection(T). Clears owner for the item being removed. (Inherited from OwnedCollectionBase(TOwner, TKey, TItem).)
Protected method SetItem Replaces the element at the specified index. Sets owner for the items being added. Clears owner for the item being removed. (Inherited from OwnedCollectionBase(TOwner, TKey, TItem).)
Protected method SetOwner Sets the owner of the item. (Overrides OwnedCollectionBase(TOwner, TKey, TItem).SetOwner(TItem, TOwner).)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
  Back to Top

See Also

Reference

CodeJam.Collections Namespace
System.Collections.ObjectModel.Collection(T)

Clone this wiki locally