Partager via


ITextBuffer.Delete Method

Deletes a sequence of characters from the buffer.

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

Syntax

'Declaration
Function Delete ( _
    deleteSpan As Span _
) As ITextSnapshot
ITextSnapshot Delete(
    Span deleteSpan
)
ITextSnapshot^ Delete(
    Span deleteSpan
)
abstract Delete : 
        deleteSpan:Span -> ITextSnapshot
function Delete(
    deleteSpan : Span
) : ITextSnapshot

Parameters

Return Value

Type: Microsoft.VisualStudio.Text.ITextSnapshot
The ITextSnapshot.

Exceptions

Exception Condition
InvalidOperationException

A ITextEdit is currently active.

ArgumentOutOfRangeException

deleteSpan.End is greater than the length of the buffer.

Remarks

This is a shortcut for creating a new ITextEdit object, using it to delete the text, and then applying it. If the deletion fails because of a read-only region, the snapshot returned will be the same as the current snapshot of the buffer before the attempted deletion.

.NET Framework Security

See Also

Reference

ITextBuffer Interface

Microsoft.VisualStudio.Text Namespace