共用方式為


IProjectionBuffer.ReplaceSpans Method

Definition

Replaces a sequence of source spans with a new list of ITrackingSpan objects and/or literal strings.

public:
 Microsoft::VisualStudio::Text::Projection::IProjectionSnapshot ^ ReplaceSpans(int position, int spansToReplace, System::Collections::Generic::IList<System::Object ^> ^ spansToInsert, Microsoft::VisualStudio::Text::EditOptions options, System::Object ^ editTag);
public Microsoft.VisualStudio.Text.Projection.IProjectionSnapshot ReplaceSpans (int position, int spansToReplace, System.Collections.Generic.IList<object> spansToInsert, Microsoft.VisualStudio.Text.EditOptions options, object editTag);
abstract member ReplaceSpans : int * int * System.Collections.Generic.IList<obj> * Microsoft.VisualStudio.Text.EditOptions * obj -> Microsoft.VisualStudio.Text.Projection.IProjectionSnapshot
Public Function ReplaceSpans (position As Integer, spansToReplace As Integer, spansToInsert As IList(Of Object), options As EditOptions, editTag As Object) As IProjectionSnapshot

Parameters

position
Int32

The position at which to begin replacing spans.

spansToReplace
Int32

The number of spans to replace.

spansToInsert
IList<Object>

The new spans to insert.

options
EditOptions

Options to apply to the span edit.

editTag
Object

An arbitrary object that will be associated with this edit transaction.

Returns

An IProjectionSnapshot.

Exceptions

spansToReplace is less than zero or position + spansToReplace is greater than SpanCount.

spansToInsert is null or a span in the list are null.

Adding a text buffer containing one of the spansToInsert would create a cycle among a set of projection buffers by virtue of the SourceBuffer relationship.

Applies to