New to Telerik Document ProcessingStart a free 30-day trial

Base collection for document model elements that manages ownership, parent links, and insertion validation.

Definition

Namespace:Telerik.Windows.Documents.Core.Data

Assembly:Telerik.Windows.Documents.Core.dll

Type Parameters:

T

The type of the document elements which should be added to the collection.

TOwner

The type of the owner of the collection.

Syntax:

C#
public abstract class DocumentElementCollectionBase<T, TOwner> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable

Inheritance: objectDocumentElementCollectionBase<T, TOwner>

Derived Classes: DocumentElementCollection<T, TOwner>DocumentElementCollection<T, TOwner>

Implements: ICollection<T>IEnumerableIEnumerable<T>IList<T>

Methods

Adds an item to the collection.

C#
public void Add(T item)
Parameters:itemT

The element to add to the collection.

Implements: ICollection<T>.Add(T)

Removes all items from the collection.

C#
public void Clear()

Implements: ICollection<T>.Clear()

Determines whether the collection contains a specific element.

C#
public bool Contains(T item)
Parameters:itemT

The element to locate in the collection.

Returns:

bool

true if item is found in the collection; otherwise, false.

Implements: ICollection<T>.Contains(T)

Copies the elements of the collection to an Array, starting at a particular Array index.

C#
public void CopyTo(T[] array, int arrayIndex)
Parameters:arrayT[]

The array.

arrayIndexint

Index of the array.

Implements: ICollection<T>.CopyTo(T[], int)

Returns an enumerator that iterates through the collection.

C#
public IEnumerator<T> GetEnumerator()
Returns:

IEnumerator<T>

A IEnumerator<T> that can be used to iterate through the collection.

Implements: IEnumerable<T>.GetEnumerator()

Determines the index of a specific element in the collection.

C#
public int IndexOf(T item)
Parameters:itemT

The element to locate in the collection.

Returns:

int

The index of item if found in the list; otherwise, -1.

Implements: IList<T>.IndexOf(T)

Inserts an element to the collection at the specified index.

C#
public void Insert(int index, T item)
Parameters:indexint

The zero-based index at which item should be inserted.

itemT

The element to insert into the collection.

Implements: IList<T>.Insert(int, T)

Inserts an elements to the collection at the specified index.

C#
public void InsertRange(int index, IEnumerable<T> items)
Parameters:indexint

The zero-based index at which items should be inserted.

itemsIEnumerable<T>

The elements to be inserted into the collection.

Called when the element is added.

C#
protected virtual void OnAfterAdd(T item)
Parameters:itemT

The element.

Called when the element is removed.

C#
protected virtual void OnAfterRemove(T item)
Parameters:itemT

The element.

Removes the first occurrence of a specific object from the collection.

C#
public bool Remove(T item)
Parameters:itemT

The object to remove from the collection.

Returns:

bool

true if item was successfully removed from the collection; otherwise, false. This method also returns false if item is not found in the original ICollection<T>.

Implements: ICollection<T>.Remove(T)

Removes the element at the specified index.

C#
public void RemoveAt(int index)
Parameters:indexint

The zero-based index of the item to remove.

Implements: IList<T>.RemoveAt(int)

Removes the range.

C#
public void RemoveRange(int index, int count)
Parameters:indexint

The zero-based index of the item to remove.

countint

The number of elements to remove.

Sets the parent of the document element.

C#
protected abstract void SetParent(T item, TOwner parent)
Parameters:itemT

The document element.

parentTOwner

The parent which should be set to the document element.

Verifies the validity of the document element before it is inserted in the collection.

C#
protected abstract void VerifyDocumentElementOnInsert(T item)
Parameters:itemT

The item.

Properties

The current number of elements in the collection, reflecting the document hierarchy state.

C#
public int Count { get; }
Property Value:

The number of elements contained in the collection.

Implements: ICollection<T>.Count

Owner

TOwner

Gets the element holding the collection.

C#
protected TOwner Owner { get; }
Property Value:

The owner element.

Access or replace the element at the zero‑based index, updating parent links accordingly.

C#
public T this[int index] { get; set; }
Parameters:indexint

The index.

Implements: IList<T>.this[int]