次の方法で共有


IProjectionBufferBase.Replace Method (Span, String)

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.

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

Syntax

'宣言
Function Replace ( _
    replaceSpan As Span, _
    replaceWith As String _
) As IProjectionSnapshot
IProjectionSnapshot Replace(
    Span replaceSpan,
    string replaceWith
)
IProjectionSnapshot^ Replace(
    Span replaceSpan, 
    String^ replaceWith
)
abstract Replace : 
        replaceSpan:Span * 
        replaceWith:string -> IProjectionSnapshot 
function Replace(
    replaceSpan : Span, 
    replaceWith : String
) : IProjectionSnapshot

Parameters

Return Value

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

Exceptions

Exception Condition
ArgumentNullException

replaceWith is nulla null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

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

InvalidOperationException

A ITextEdit 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.

.NET Framework Security

See Also

Reference

IProjectionBufferBase Interface

Replace Overload

Microsoft.VisualStudio.Text.Projection Namespace