共用方式為


ITextBuffer.Delete(Span) Method

Definition

Deletes a sequence of characters from the buffer.

public:
 Microsoft::VisualStudio::Text::ITextSnapshot ^ Delete(Microsoft::VisualStudio::Text::Span deleteSpan);
public:
 Microsoft::VisualStudio::Text::ITextSnapshot ^ Delete(Microsoft::VisualStudio::Text::Span deleteSpan);
Microsoft::VisualStudio::Text::ITextSnapshot Delete(Microsoft::VisualStudio::Text::Span deleteSpan);
public Microsoft.VisualStudio.Text.ITextSnapshot Delete (Microsoft.VisualStudio.Text.Span deleteSpan);
abstract member Delete : Microsoft.VisualStudio.Text.Span -> Microsoft.VisualStudio.Text.ITextSnapshot
Public Function Delete (deleteSpan As Span) As ITextSnapshot

Parameters

deleteSpan
Span

The span of characters to delete.

Returns

The ITextSnapshot.

Exceptions

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

A TextEdit is currently active, or CheckEditAccess() would return false.

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 on account of a read-only region, the snapshot returned will be the same as the current snapshot of the buffer before the attempted deletion.

Applies to