IProjectionBufferBase.Replace(Span, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Exceptions
replaceSpan
.The end of the span is greater than the length of the buffer.
replaceWith
is 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.