Share via


IProjectionBufferBase.Replace(Span, String) Method

Definition

Replaces a span of characters with different text. This is equivalent to first deleting the text to be replaced and then inserting the new text.

public:
 Microsoft::VisualStudio::Text::Projection::IProjectionSnapshot ^ Replace(Microsoft::VisualStudio::Text::Span replaceSpan, System::String ^ replaceWith);
public:
 Microsoft::VisualStudio::Text::Projection::IProjectionSnapshot ^ Replace(Microsoft::VisualStudio::Text::Span replaceSpan, Platform::String ^ replaceWith);
Microsoft::VisualStudio::Text::Projection::IProjectionSnapshot Replace(Microsoft::VisualStudio::Text::Span replaceSpan, std::wstring const & replaceWith);
public Microsoft.VisualStudio.Text.Projection.IProjectionSnapshot Replace (Microsoft.VisualStudio.Text.Span replaceSpan, string replaceWith);
abstract member Replace : Microsoft.VisualStudio.Text.Span * string -> Microsoft.VisualStudio.Text.Projection.IProjectionSnapshot
Public Function Replace (replaceSpan As Span, replaceWith As String) As IProjectionSnapshot

Parameters

replaceSpan
Span

The span of characters to replace.

replaceWith
String

The new text.

Returns

An IProjectionSnapshot.

Exceptions

replaceSpan.The end of the span is greater than the length of the buffer.

replaceWithis null.

A TextEdit is currently active.

Remarks

This is a shortcut for creating a new ITextEdit object, using it to replace the text, and then applying it. If the replacement 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 replacement.

Applies to