Freigeben über


ITextEdit.Replace Method (Span, String)

Replaces a sequence of characters with different text.

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

Syntax

'Declaration
Function Replace ( _
    replaceSpan As Span, _
    replaceWith As String _
) As Boolean
bool Replace(
    Span replaceSpan,
    string replaceWith
)
bool Replace(
    Span replaceSpan, 
    String^ replaceWith
)
abstract Replace : 
        replaceSpan:Span * 
        replaceWith:string -> bool 
function Replace(
    replaceSpan : Span, 
    replaceWith : String
) : boolean

Parameters

Return Value

Type: System.Boolean
true if the replacement succeeded, false if it was prevented by a read-only region.

Exceptions

Exception Condition
ArgumentNullException

replaceWith is null.

InvalidOperationException

The Apply or Cancel or Dispose method has previously been called on this object.

ArgumentOutOfRangeException

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

Remarks

This method has the same effect as first deleting the characters in replaceSpan and then inserting replaceWith.

Replacing an empty span with an empty string will succeed but will not generate a new snapshot or raise a Changed event.

.NET Framework Security

See Also

Reference

ITextEdit Interface

Replace Overload

Microsoft.VisualStudio.Text Namespace