In This Article

ICollectionTagger<T> Interface

Provides the base requirements for an ITagger<T> that maintains a simple collection of tagged ranges.

public interface ICollectionTagger<T> : ITagger<T>, ITaggerBase, IOrderable, IKeyedObject where T : ITag
Type Parameters:
T -

The tag type.

Properties

Count

The number of elements contained in the collection.

int Count { get; }

Property Value

int

this[T]

The tag range that points to the specified tag.

TagVersionRange<T>? this[T tag] { get; }
Parameter Type Description
tag T

The tag for which to search.

Property Value

TagVersionRange<T>

Methods

Add(ITextSnapshotLine, T)

Adds a tag range that is associated with a single snapshot line (e.g., a bookmark indicator tag).

TagVersionRange<T> Add(ITextSnapshotLine snapshotLine, T tag)
Parameter Type Description
snapshotLine ITextSnapshotLine

The target ITextSnapshotLine.

tag T

The ITag to add.

Returns

TagVersionRange<T>:

The TagVersionRange<T> that was created.

Remarks

The generated ITextVersionRange is created with the DeleteWhenZeroLength and LineBased flags.

Add(TagVersionRange<T>)

Adds a tag range to the collection.

void Add(TagVersionRange<T> tagRange)
Parameter Type Description
tagRange TagVersionRange<T>

The tag range to add to the collection.

Remarks

This is the lowest-level method used for adding a tag range, and gives the most control over snapshot translation options.

Add(TextSnapshotRange, T)

Adds a tag range that is applied to a snapshot text range (e.g., a breakpoint indicator tag).

TagVersionRange<T> Add(TextSnapshotRange snapshotRange, T tag)
Parameter Type Description
snapshotRange TextSnapshotRange

The target TextSnapshotRange.

tag T

The ITag to add.

Returns

TagVersionRange<T>:

The TagVersionRange<T> that was created.

Remarks

The generated ITextVersionRange is created with the DeleteWhenZeroLength flag.

Clear()

Removes all items from the collection.

void Clear()

Contains(TagVersionRange<T>)

Determines whether the collection contains a specific value.

bool Contains(TagVersionRange<T> tagRange)
Parameter Type Description
tagRange TagVersionRange<T>

The object to locate in the collection.

Returns

bool:

true if the item is found in the collection; otherwise, false.

CopyTo(TagVersionRange<T>[], int)

Copies the entire collection to a compatible one-dimensional Array, starting at the specified index of the target array.

void CopyTo(TagVersionRange<T>[] array, int arrayIndex)
Parameter Type Description
array TagVersionRange<T>[]

The one-dimensional Array that is the destination of the elements copied from the collection. The Array must have zero-based indexing.

arrayIndex int

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

CreateBatch()

Creates an IDisposable object such that while the object is not disposed, items can be added to this collection without any change events being fired, thereby allowing batch updates to occur.

IDisposable CreateBatch()

Returns

IDisposable:

An IDisposable object that, once disposed, will end the batch.

FindNext(ITextSnapshotLine, ITagSearchOptions<T>?)

Finds the next line-based tag (e.g., a bookmark indicator tag), using the specified search options.

TagVersionRange<T>? FindNext(ITextSnapshotLine snapshotLine, ITagSearchOptions<T>? options)
Parameter Type Description
snapshotLine ITextSnapshotLine

The ITextSnapshotLine from which to start the search.

options ITagSearchOptions<T>

The optional ITagSearchOptions<T> that specifies search options.

Returns

TagVersionRange<T>:

The TagVersionRange<T> that was found, if any.

FindNext(TextSnapshotOffset, ITagSearchOptions<T>?)

Finds the next text range-based tag (e.g., a breakpoint indicator tag), using the specified search options.

TagVersionRange<T>? FindNext(TextSnapshotOffset snapshotOffset, ITagSearchOptions<T>? options)
Parameter Type Description
snapshotOffset TextSnapshotOffset

The TextSnapshotOffset from which to start the search.

options ITagSearchOptions<T>

The optional ITagSearchOptions<T> that specifies search options.

Returns

TagVersionRange<T>:

The TagVersionRange<T> that was found, if any.

GetEnumerator()

Returns an enumerator that iterates through the collection.

IEnumerator<TagVersionRange<T>> GetEnumerator()

Returns

IEnumerator<TagVersionRange<T>>:

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

IsTagIncluded(T, TextSnapshotRange, TextSnapshotRange)

Returns whether the specified tag's snapshot range intersects with the target snapshot range, used to determine results for the GetTags(NormalizedTextSnapshotRangeCollection, object?) method.

bool IsTagIncluded(T tag, TextSnapshotRange tagSnapshotRange, TextSnapshotRange targetSnapshotRange)
Parameter Type Description
tag T

The tag to examine.

tagSnapshotRange TextSnapshotRange

The tag's TextSnapshotRange.

targetSnapshotRange TextSnapshotRange

The target TextSnapshotRange.

Returns

bool:

true if there is intersection within the requested snapshot range; otherwise, false.

Remove(TagVersionRange<T>)

Removes the first occurrence of a specific tag range from the collection.

bool Remove(TagVersionRange<T> tagRange)
Parameter Type Description
tagRange TagVersionRange<T>

The tag range to remove from the collection.

Returns

bool:

true if the tag range was successfully removed from the collection; otherwise, false

Remove(T)

Removes a specific tag instance from the collection.

bool Remove(T tag)
Parameter Type Description
tag T

The ITag to remove from the collection.

Returns

bool:

true if the tag was successfully removed from the collection; otherwise, false

RemoveAll(Predicate<TagVersionRange<T>>)

Removes all objects that match the conditions defined by the specified predicate.

int RemoveAll(Predicate<TagVersionRange<T>> match)
Parameter Type Description
match Predicate<TagVersionRange<T>>

The predicate that defines the conditions for removal.

Returns

int:

The number of objects that were removed.

Toggle(ITextSnapshotLine, T)

Toggles whether a tag is associated with a single snapshot line (e.g., a bookmark indicator tag).

TagVersionRange<T>? Toggle(ITextSnapshotLine snapshotLine, T tag)
Parameter Type Description
snapshotLine ITextSnapshotLine

The target ITextSnapshotLine.

tag T

The ITag to add, if no tag is already on the line.

Returns

TagVersionRange<T>:

The TagVersionRange<T> that was created, if a tag was added.

Toggle(TextSnapshotRange, T)

Toggles whether a tag is associated with a snapshot text range (e.g., a breakpoint indicator tag).

TagVersionRange<T>? Toggle(TextSnapshotRange snapshotRange, T tag)
Parameter Type Description
snapshotRange TextSnapshotRange

The target TextSnapshotRange.

tag T

The ITag to add, if no tag is already in the text range.

Returns

TagVersionRange<T>:

The TagVersionRange<T> that was created, if a tag was added.

Inherited Members

Extension Methods