Partager via


IProjectionBuffer.InsertSpans Method

Inserts a list of ITrackingSpan objects and/or literal strings into the list of source spans in the order in which they appear in the list.

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

Syntax

'Déclaration
Function InsertSpans ( _
    position As Integer, _
    spansToInsert As IList(Of Object) _
) As IProjectionSnapshot
IProjectionSnapshot InsertSpans(
    int position,
    IList<Object> spansToInsert
)
IProjectionSnapshot^ InsertSpans(
    int position, 
    IList<Object^>^ spansToInsert
)
abstract InsertSpans : 
        position:int * 
        spansToInsert:IList<Object> -> IProjectionSnapshot 
function InsertSpans(
    position : int, 
    spansToInsert : IList<Object>
) : IProjectionSnapshot

Parameters

  • position
    Type: System.Int32
    The position at which to insert the spans.

Return Value

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

Exceptions

Exception Condition
ArgumentNullException

spansToInsert is nulla null reference (Nothing in Visual Basic) or a span in that list is null.

ArgumentOutOfRangeException

position is less than zero or 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 option.

-or-

Adding one of the text buffers containing any 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