Condividi tramite


IProjectionBuffer.ReplaceSpans Method

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

Namespace:  Microsoft.VisualStudio.Text.Projection
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

Syntax

'Dichiarazione
Function ReplaceSpans ( _
    position As Integer, _
    spansToReplace As Integer, _
    spansToInsert As IList(Of Object), _
    options As EditOptions, _
    editTag As Object _
) As IProjectionSnapshot
IProjectionSnapshot ReplaceSpans(
    int position,
    int spansToReplace,
    IList<Object> spansToInsert,
    EditOptions options,
    Object editTag
)
IProjectionSnapshot^ ReplaceSpans(
    int position, 
    int spansToReplace, 
    IList<Object^>^ spansToInsert, 
    EditOptions options, 
    Object^ editTag
)
abstract ReplaceSpans : 
        position:int * 
        spansToReplace:int * 
        spansToInsert:IList<Object> * 
        options:EditOptions * 
        editTag:Object -> IProjectionSnapshot 
function ReplaceSpans(
    position : int, 
    spansToReplace : int, 
    spansToInsert : IList<Object>, 
    options : EditOptions, 
    editTag : Object
) : IProjectionSnapshot

Parameters

  • position
    Type: System.Int32
    The position at which to begin replacing spans.
  • spansToReplace
    Type: System.Int32
    The number of spans to replace.
  • editTag
    Type: System.Object
    An object that will be associated with this edit transaction.

Return Value

Type: Microsoft.VisualStudio.Text.Projection.IProjectionSnapshot
An IProjectionSnapshot.

Exceptions

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.

.NET Framework Security

See Also

Reference

IProjectionBuffer Interface

Microsoft.VisualStudio.Text.Projection Namespace