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

Gets the number of elements contained in the collection.

int Count { get; }

Property Value

int:

The number of elements contained in the collection.

this[T]

Gets the tag range that points to the specified tag.

[C#] In C#, this property is the indexer for the ICollectionTagger interface.

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

The tag for which to search.

Property Value

TagVersionRange<T>:

The tag range that points to the specified tag.

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. Once disposed, the batch is ended.

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()

Retrieves an IEnumerator object for the entire collection.

IEnumerator<TagVersionRange<T>> GetEnumerator()

Returns

IEnumerator<TagVersionRange<T>>:

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.

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