Class ChildCollection<TParent, TChild>
Provides a collection of child objects for a content item.
Links from a child object to its parent are maintained as the collection contents are modified.
public abstract class ChildCollection<TParent, TChild> : Collection<TChild>, IList<TChild>, ICollection<TChild>, IReadOnlyList<TChild>, IReadOnlyCollection<TChild>, IEnumerable<TChild>, IList, ICollection, IEnumerable where TParent : class where TChild : class
Type Parameters
TParent
TChild
- Inheritance
-
Collection<TChild>ChildCollection<TParent, TChild>
- Implements
-
IList<TChild>ICollection<TChild>IReadOnlyList<TChild>IReadOnlyCollection<TChild>IEnumerable<TChild>
- Derived
- Inherited Members
Constructors
ChildCollection(TParent)
Creates an instance of ChildCollection.
protected ChildCollection(TParent parent)
Parameters
parent
TParentParent object of the child objects returned in the collection.
Methods
ClearItems()
Removes all children from the collection.
protected override void ClearItems()
GetParent(TChild)
Gets the parent of a child object.
protected abstract TParent GetParent(TChild child)
Parameters
child
TChildThe child of the parent being retrieved.
Returns
- TParent
The parent of the child object.
InsertItem(int, TChild)
Inserts a child object into the collection at the specified location.
protected override void InsertItem(int index, TChild item)
Parameters
index
intThe position in the collection.
item
TChildThe child object being inserted.
RemoveItem(int)
Removes a child object from the collection.
protected override void RemoveItem(int index)
Parameters
index
intThe index of the item being removed.
SetItem(int, TChild)
Modifies the value of the child object at the specified location.
protected override void SetItem(int index, TChild item)
Parameters
index
intThe index of the child object being modified.
item
TChildThe new value for the child object.
SetParent(TChild, TParent)
Modifies the value of the parent object of the specified child object.
protected abstract void SetParent(TChild child, TParent parent)
Parameters
child
TChildThe child of the parent being modified.
parent
TParentThe new value for the parent object.