New to Telerik UI for WinForms? Start a free 30-day trial

Stores selection ranges and exposes valid ranges through its count, boundary properties, and enumerator.

Definition

Namespace:Telerik.WinForms.Documents.Selection

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class SelectionRangeCollection : IEnumerable

Inheritance: objectSelectionRangeCollection

Implements: IEnumerable

Constructors

Initializes an empty collection of selection ranges.

C#
public SelectionRangeCollection()

Properties

Gets the number of valid ranges, excluding invalid entries.

C#
public int Count { get; }

Gets the first valid range, or null if no valid range exists.

C#
public SelectionRange First { get; }

Gets true because Add(SelectionRange) and Remove(SelectionRange) are not supported.

C#
public bool IsReadOnly { get; }

Gets the last valid range, or null if no valid range exists.

C#
public SelectionRange Last { get; }

Methods

This operation is not supported; ranges are managed by the owning selection.

C#
public void Add(SelectionRange item)
Parameters:itemSelectionRange

The range that would be added.

Exceptions: InvalidOperationException

Always thrown because this collection does not support adding ranges.

Removes all ranges and releases their document-position event subscriptions.

C#
public void Clear()

Determines whether the collection stores the specified range instance, including invalid entries.

C#
public bool Contains(SelectionRange item)
Parameters:itemSelectionRange

The range to locate.

Returns:

bool

true if the range is stored; otherwise, false.

Copies the valid ranges into an array, creating a copy of each range.

C#
public void CopyTo(SelectionRange[] array, int arrayIndex)
Parameters:arraySelectionRange[]

The destination array.

arrayIndexint

The number of valid ranges to skip; copied ranges are written starting at destination index zero.

Exceptions: ArgumentException

The destination array is shorter than the collection's valid range count.

Enumerates the valid ranges in their current collection order.

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

IEnumerator<SelectionRange>

An enumerator over valid selection ranges.

This operation is not supported; ranges are managed by the owning selection.

C#
public bool Remove(SelectionRange item)
Parameters:itemSelectionRange

The range that would be removed.

Returns:

bool

This method does not return; it always throws.

Exceptions: InvalidOperationException

Always thrown because this collection does not support removing individual ranges.

Sorts the stored ranges by descending start position and returns this collection.

C#
public SelectionRangeCollection SortDescending()
Returns:

SelectionRangeCollection

This collection after sorting.