NormalizedTextSnapshotRangeCollection Class
Represents a read-only normalized text snapshot range collection.
public class NormalizedTextSnapshotRangeCollection : IList<TextSnapshotRange>, ICollection<TextSnapshotRange>, IEnumerable<TextSnapshotRange>, IEnumerable
- Inheritance:
- Object Object
Constructors
NormalizedTextSnapshotRangeCollection()
Initializes a new instance of the NormalizedTextSnapshotRangeCollection
class.
public NormalizedTextSnapshotRangeCollection()
NormalizedTextSnapshotRangeCollection(TextSnapshotRange[])
Initializes a new instance of the NormalizedTextSnapshotRangeCollection
class.
public NormalizedTextSnapshotRangeCollection(params TextSnapshotRange[] snapshotRanges)
Parameter | Type | Description |
---|---|---|
snapshotRanges | TextSnapshotRange[] | The TextSnapshotRange objects to add to the collection. |
NormalizedTextSnapshotRangeCollection(IEnumerable<TextSnapshotRange>)
Initializes a new instance of the NormalizedTextSnapshotRangeCollection
class.
public NormalizedTextSnapshotRangeCollection(IEnumerable<TextSnapshotRange> snapshotRanges)
Parameter | Type | Description |
---|---|---|
snapshotRanges | IEnumerable<TextSnapshotRange> | The TextSnapshotRange objects to add to the collection. |
NormalizedTextSnapshotRangeCollection(IEnumerable<TextSnapshotRange>, Boolean)
Initializes a new instance of the NormalizedTextSnapshotRangeCollection
class.
public NormalizedTextSnapshotRangeCollection(IEnumerable<TextSnapshotRange> snapshotRanges, bool mergeSequentialRanges)
Parameter | Type | Description |
---|---|---|
snapshotRanges | IEnumerable<TextSnapshotRange> | The TextSnapshotRange objects to add to the collection. |
mergeSequentialRanges | Boolean | Whether to merge sequential ranges. |
Properties
Count
Gets the number of elements contained in the collection.
Item[Int32]
Gets or sets the item at the specified index.
[C#] In C#, this property is the indexer for the NormalizedTextSnapshotRangeCollection
class.
public TextSnapshotRange this[int index] { get; set; }
Parameter | Type | Description |
---|---|---|
index | Int32 | 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
- Int32:
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 collection contains a specific value.
public bool Contains(TextSnapshotRange item)
Parameter | Type | Description |
---|---|---|
item | TextSnapshotRange | The object to locate in the collection. |
Returns
- Boolean:
true
if the item is found in the collection; otherwise,false
.
CopyTo(TextSnapshotRange[], Int32)
Copies the entire collection to a compatible one-dimensional Array
,
starting at the specified index of the target array.
public void CopyTo(TextSnapshotRange[] array, int arrayIndex)
Parameter | Type | Description |
---|---|---|
array | TextSnapshotRange[] | The one-dimensional |
arrayIndex | Int32 | The zero-based index in |
GetEnumerator()
Retrieves an IEnumerator
object for the entire collection.
public IEnumerator<TextSnapshotRange> GetEnumerator()
Returns
- IEnumerator<TextSnapshotRange>:
An
IEnumerator
object for the entire collection
Remarks
Enumerators are intended to be used only to read data in the collection. Enumerators cannot be used to modify the underlying collection.
The enumerator does not have exclusive access to the collection.
When an enumerator is instantiated, it takes a snapshot of the current state of the collection.
If changes are made to the collection, such as adding, modifying or deleting elements, the
snapshot gets out of sync and the enumerator throws an InvalidOperationException
.
Two enumerators instantiated from the same collection at the same time can have
different snapshots of the collection.
GetInverse(TextSnapshotRange)
Gets a NormalizedTextSnapshotRangeCollection that contains the inverse ranges contained in this instance.
public NormalizedTextSnapshotRangeCollection GetInverse(TextSnapshotRange targetSnapshotRange)
Parameter | Type | Description |
---|---|---|
targetSnapshotRange | TextSnapshotRange | The TextSnapshotRange over which to return ranges. |
Returns
- NormalizedTextSnapshotRangeCollection:
A NormalizedTextSnapshotRangeCollection that contains the inverse ranges contained in this instance.
IndexOf(TextSnapshotRange)
Returns the index of the specified item in the collection.
public int IndexOf(TextSnapshotRange item)
Parameter | Type | Description |
---|---|---|
item | TextSnapshotRange | The item to look for. |
Returns
- Int32:
If found, the index where the item is in the collection; otherwise,
-1
.
Inherited Members
- Object.ToString()
- Object.Equals(Object)
- Object.Equals(Object, Object)
- Object.ReferenceEquals(Object, Object)
- Object.GetHashCode()
- Object.GetType()
- Object.MemberwiseClone()