IProjectionBuffer::ReplaceSpans Method (Int32, Int32, IList<Object^>^, EditOptions, Object^)
Replaces a sequence of source spans with a new list of ITrackingSpan objects and/or literal strings.
Assembly: Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)
IProjectionSnapshot^ ReplaceSpans( int position, int spansToReplace, IList<Object^>^ spansToInsert, EditOptions options, Object^ editTag )
Parameters
- position
-
Type:
System::Int32
The position at which to begin replacing spans.
- spansToReplace
-
Type:
System::Int32
The number of spans to replace.
- spansToInsert
-
Type:
System.Collections.Generic::IList<Object^>^
The new spans to insert.
- options
-
Type:
Microsoft.VisualStudio.Text::EditOptions
Options to apply to the span edit.
- editTag
-
Type:
System::Object^
An object that will be associated with this edit transaction.
Return Value
Type: Microsoft.VisualStudio.Text.Projection::IProjectionSnapshot^| Exception | Condition |
|---|---|
| ArgumentNullException | spansToInsert is null or a span in the list are null. |
| ArgumentOutOfRangeException | position is less than zero or greater than the number of spans. -or- spansToReplace is less than zero or position + spansToReplace is greater than the number of spans. |
| ArgumentException | An element of spansToInsert is neither an ITrackingSpan nor a string. -or- A span in spansToInsert would cause a duplicated projection. -or- A tracking span in spansToInsert is EdgeInclusive and does not cover its entire buffer, or is EdgePositive and does not abut the end of its buffer, or is EdgeNegative and does not abut the beginning of its buffer. (These checks are not performed if the projection buffer was created with the PermissiveEdgeInclusiveSourceSpans.) -or- Adding a text buffer containing one of the spansToInsert would create a cycle among a set of projection buffers. |