In This Article

NormalizedTextSnapshotRangeCollection Class

Represents a read-only normalized text snapshot range collection.

public class NormalizedTextSnapshotRangeCollection
Inheritance:
object object

Constructors

NormalizedTextSnapshotRangeCollection()

Initializes an instance of the class.

public NormalizedTextSnapshotRangeCollection()

NormalizedTextSnapshotRangeCollection(params TextSnapshotRange[])

Initializes an instance of the class.

public NormalizedTextSnapshotRangeCollection(params TextSnapshotRange[] snapshotRanges)
Parameter Type Description
snapshotRanges TextSnapshotRange[]

The TextSnapshotRange objects to add to the collection.

NormalizedTextSnapshotRangeCollection(IEnumerable<TextSnapshotRange>)

Initializes an instance of the class.

public NormalizedTextSnapshotRangeCollection(IEnumerable<TextSnapshotRange> snapshotRanges)
Parameter Type Description
snapshotRanges IEnumerable<TextSnapshotRange>

The TextSnapshotRange objects to add to the collection.

NormalizedTextSnapshotRangeCollection(IEnumerable<TextSnapshotRange>, bool)

Initializes an instance of the class.

public NormalizedTextSnapshotRangeCollection(IEnumerable<TextSnapshotRange> snapshotRanges, bool mergeSequentialRanges)
Parameter Type Description
snapshotRanges IEnumerable<TextSnapshotRange>

The TextSnapshotRange objects to add to the collection.

mergeSequentialRanges bool

Whether to merge sequential ranges.

Properties

Count

Gets the number of elements contained in the ICollection<T>.

public int Count { get; }

Property Value

int:

The number of elements contained in the ICollection<T>.

this[int]

The item at the specified index.

public TextSnapshotRange this[int index] { get; set; }
Parameter Type Description
index int

The index of the item to return.

Property Value

TextSnapshotRange:

The item at the specified index.

Methods

BinarySearch(TextSnapshotOffset)

Performs a binary search for the specified value, with translating offsets.

public int BinarySearch(TextSnapshotOffset snapshotOffset)
Parameter Type Description
snapshotOffset TextSnapshotOffset

The value for which to search.

Returns

int:

The index of the specified value in the specified array, if value is found. If value is not found and value is less than one or more elements in array, a negative number which is the bitwise complement of the index of the first element that is larger than value. If value is not found and value is greater than any of the elements in array, a negative number which is the bitwise complement of (the index of the last element plus 1).

Contains(TextSnapshotRange)

Determines whether the ICollection<T> contains a specific value.

public bool Contains(TextSnapshotRange item)
Parameter Type Description
item TextSnapshotRange

The object to locate in the ICollection<T>.

Returns

bool:

true if item is found in the ICollection<T>; otherwise, false.

CopyTo(TextSnapshotRange[], int)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

public void CopyTo(TextSnapshotRange[] array, int arrayIndex)
Parameter Type Description
array TextSnapshotRange[]

The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.

arrayIndex int

The zero-based index in array at which copying begins.

Exceptions

Type Condition
ArgumentNullException

array is null.

ArgumentOutOfRangeException

arrayIndex is less than 0.

ArgumentException

The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<TextSnapshotRange> GetEnumerator()

Returns

IEnumerator<TextSnapshotRange>:

An enumerator that can be used to iterate through the collection.

GetInverse(TextSnapshotRange)

Returns a NormalizedTextSnapshotRangeCollection that contains the inverse ranges contained in instance.

public NormalizedTextSnapshotRangeCollection GetInverse(TextSnapshotRange targetSnapshotRange)
Parameter Type Description
targetSnapshotRange TextSnapshotRange

The TextSnapshotRange over which to return ranges.

Returns

NormalizedTextSnapshotRangeCollection

IndexOf(TextSnapshotRange)

Determines the index of a specific item in the IList<T>.

public int IndexOf(TextSnapshotRange item)
Parameter Type Description
item TextSnapshotRange

The object to locate in the IList<T>.

Returns

int:

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

Inherited Members

Extension Methods