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
TParentTChild
- 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
parentTParentParent 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
childTChildThe 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
indexintThe position in the collection.
itemTChildThe child object being inserted.
RemoveItem(int)
Removes a child object from the collection.
protected override void RemoveItem(int index)
Parameters
indexintThe 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
indexintThe index of the child object being modified.
itemTChildThe 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
childTChildThe child of the parent being modified.
parentTParentThe new value for the parent object.