RichTextElementCollection<T> Class
Definition
A collection of child TextElements. Works both before and after document attachment.
public class RichTextElementCollection<T>
Constructors
| Name | Description |
|---|---|
| RichTextElementCollection<T> | Creates a new collection for the specified owner. |
RichTextElementCollection<T> Constructor
Creates a new collection for the specified owner.
public RichTextElementCollection<T>(Avalonia.AvaloniaObject owner)
Parameters
owner Avalonia.AvaloniaObject
Remarks
Reach the collection through its owner rather than building one: an owner caches exactly one instance, and a second over the same owner splits pending content between them.
Methods
| Name | Description |
|---|---|
| Add | Adds an element to the collection. |
| AddRange | No summary available. |
| Clear | Clears all elements. |
| Contains | Returns whether the specified element is present in the collection. |
| CopyTo | Copies all elements to the specified array starting at arrayIndex. |
| FirstOrDefault | The first element, or the type's default when the collection is empty. |
| FirstOrNull | Gets the first element, or null when the collection is empty. |
| GetEnumerator | Returns an enumerator that iterates over the elements in this collection. |
| IndexOf | Returns the zero-based index of the specified element, or -1 if not found. |
| Insert | Inserts an element at the specified index. |
| LastOrDefault | The last element, or the type's default when the collection is empty. |
| LastOrNull | Gets the last element, or null when the collection is empty. |
| Remove | Removes an element from the collection. |
| RemoveAt | Removes the element at the specified index. |
Add Method
Adds an element to the collection.
public void Add(T item)
Parameters
item T
AddRange Method
public void AddRange(System.Collections.Generic.IEnumerable<T> items)
Parameters
items System.Collections.Generic.IEnumerable<T>
Clear Method
Clears all elements.
public void Clear()
Contains Method
Returns whether the specified element is present in the collection.
public bool Contains(T item)
Parameters
item T
Returns
bool
CopyTo Method
Copies all elements to the specified array starting at arrayIndex.
public void CopyTo(T[] array, int arrayIndex)
Parameters
array T[]
arrayIndex int
FirstOrDefault Method
The first element, or the type's default when the collection is empty.
public T FirstOrDefault()
Returns
T
The first element, or .
FirstOrNull Method
Gets the first element, or null when the collection is empty.
public T FirstOrNull()
Returns
T
Remarks
Named apart from the LINQ extension the collection also carries, so a reader can tell at the call site which one runs.
GetEnumerator Method
Returns an enumerator that iterates over the elements in this collection.
public System.Collections.Generic.IEnumerator<T> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<T>
IndexOf Method
Returns the zero-based index of the specified element, or -1 if not found.
public int IndexOf(T item)
Parameters
item T
Returns
int
Insert Method
Inserts an element at the specified index.
public void Insert(int index, T item)
Parameters
index int
item T
LastOrDefault Method
The last element, or the type's default when the collection is empty.
public T LastOrDefault()
Returns
T
The last element, or .
LastOrNull Method
Gets the last element, or null when the collection is empty.
public T LastOrNull()
Returns
T
Remarks
Named apart from the LINQ extension the collection also carries; see Avalonia.Controls.Documents.RichTextElementCollection<T>.FirstOrNull.
Remove Method
Removes an element from the collection.
public bool Remove(T item)
Parameters
item T
Returns
bool
RemoveAt Method
Removes the element at the specified index.
public void RemoveAt(int index)
Parameters
index int
Properties
| Name | Description |
|---|---|
| Count | Gets the number of elements in the collection. |
| IsReadOnly | Gets a value indicating whether this collection is read-only. |
| Item | No summary available. |
Count Property
Gets the number of elements in the collection.
public int Count { get; set; }
IsReadOnly Property
Gets a value indicating whether this collection is read-only.
public bool IsReadOnly { get; set; }
Item Property
public T Item { get; set; }