ClassStackCollection<T>
Name-addressable stack of elements that preserves order and allows O(1) lookup by the element name.
Definition
Namespace:Telerik.Windows.Documents.Core.Data
Assembly:Telerik.Windows.Documents.Core.dll
Type Parameters:
T
Syntax:
public class StackCollection<T> : ICollection<T>, IEnumerable<T>, IEnumerable where T : IStackCollectionElement
Inheritance: objectStackCollection<T>
Implements:
Constructors
StackCollection()
Create an empty collection with indexing by element name and linked-list ordering for fast inserts.
Declaration
public StackCollection()
Properties
Count
The number of elements currently in the collection.
Declaration
public int Count { get; }
Property Value
The number of elements contained in the collection.
Implements
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
true if the ICollection<T> is read-only; otherwise, false.
Implements
Methods
Add(T)
Push an element to the end of the stack and index it by name.
Declaration
public void Add(T item)
Parameters
item
T
The item.
Implements
AddAfter(string, T)
Insert element after the element with the given name.
AddBefore(string, T)
Insert layer before the element with the given name.
AddFirst(T)
Insert an element at the start of the stack and index it by name.
Declaration
public void AddFirst(T element)
Parameters
element
T
The element.
AddLast(T)
Append an element at the end of the stack and index it by name.
Declaration
public void AddLast(T element)
Parameters
element
T
The element.
Clear()
Removes all items from the ICollection<T>.
Declaration
public void Clear()
Exceptions
The ICollection<T> is read-only.
Implements
Contains(T)
Check whether an element instance exists in the collection by its name.
Declaration
public bool Contains(T item)
Parameters
item
T
The item.
Returns
Implements
Contains(string)
Check for the existence of an element by its unique name.
CopyTo(T[], int)
Copy the elements to the provided array starting at the specified index while maintaining order.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
array
T[]
The array.
arrayIndex
Index of the array.
Implements
GetElementByName(string)
Find an element by its unique name and return it, or the default value if not present.
Declaration
public T GetElementByName(string elementName)
Parameters
elementName
Name of the element.
Returns
T
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
IEnumerator<T>
A IEnumerator<T> that can be used to iterate through the collection.
Implements
Remove(T)
Remove an element instance from the collection and its name index.
Declaration
public bool Remove(T item)
Parameters
item
T
The item.
Returns
Implements
Remove(string)
Remove an element by name if present.